I came up with a way to modify Dijkstra’s Algorithm to handle graphs with some negative edge weighs (as long as there are no negative cycles) [duplicate]

This question already has an answer here:

  • Why can't we find shortest paths with negative weights by just adding a constant so that all weights are positive? 2 answers
  1. Let $ w_{min} < 0$ be the lowest weight of an edge in $ G$ .
  2. Add a constant $ c\geq |w_{min}|$ to each edge of $ G$ , so that each edge now has non-negative weight.
  3. Run Dijkstra’s algorithm on this modified graph.
  4. Compensate for the added weighs on each edge by subtracting them from the total distance.

Can anyone tell me if this is viable or if it fails?

Why is BFS “vertex based” and DFS “edge based”?

I am trying to understand the various differences between Breadth-first and Depth-first search on graphs. Two sources state that BFS is “vertex based” and DFS is “edge based” even though in implementation, we use the vertices to iterate over.

So, what exactly does “vertex based” and “edge based” mean in this context?

Sources: (1) https://www.geeksforgeeks.org/difference-between-bfs-and-dfs/ (2) https://techdifferences.com/difference-between-bfs-and-dfs.html

EDGE processing of Multiline Rich Text URLs in JQuery

I am having difficulties setting up URL values within a list Multiline Rich Text field. The code I am using is as follows:

      ThisList = "TK0001 TK0002 TK0003 TK0004"       TaskArray = ThisList.split(" ");       var AssocHTML = '';       for (i = 0; i < TaskArray.length; i++) {                AssocHTML = AssocHTML + '<a href="https://oursites<snip>/Lists/TestList/DispForm.aspx?ID='+TaskArray[i].substr(j+2) + '&RootFolder=%2A">'+TaskArray[i]+'</a> ';                           };       $  ('nobr:contains("Task List")').closest('tr').find('div.ms-rtestate-write').html(AssocHTML);                           }; 

If I run this code using IE, the field is populated correctly

"<a href="https://oursites<snip>/Lists/TestList/DispForm.aspx?ID=0001&RootFolder=%2A">TK0001</a> <a href="https://oursites<snip>/Lists/TestList/DispForm.aspx?ID=0002&RootFolder=%2A">TK0002</a> <a href="https://oursites<snip>/Lists/TestList/DispForm.aspx?ID=0003&RootFolder=%2A">TK0003</a> <a href="https://oursites<snip>/Lists/TestList/DispForm.aspx?ID=0004&RootFolder=%2A">TK0004</a>" 

However, if I run this same code under EDGE, the following value is populated into that field

"<a href="/Lists/TestList/DispForm.aspx?ID=0001&RootFolder=%2A">TK0001</a> <a href="/Lists/TestList/DispForm.aspx?ID=0002&RootFolder=%2A">TK0002</a> <a href="/Lists/TestList/DispForm.aspx?ID=0003&RootFolder=%2A">TK0003</a> <a>TK0004</a>" 

The URL is modified (fair enough) but the last value is always corrupted.

How do I stop EDGE applying field edits, or is there some encoding that I need to apply to the AssocHTML value to stop EDGE reevaluating the value?

Maximum flow with maximum flow on specific edge

I am trying to solve the following problem:

We’re given a network flow $ (V,E,c,s,t)$ and an edge $ (u,v)$ . We have to provide an algorithm that computes the maximum flow which has maximum flow on $ (u,v)$ also.

The idea that I had was, computing max flow and on the residual graph trying to compute a cycle that starts from $ s$ and passes through the edge $ (u,v)$ and trying to increase $ (u,v)$ ‘s flow while decreasing the flow from other edges. In other words, trying to maximize the flow of $ (u,v)$ while preserving the maximum flow value. But I feel like there’s a simpler way.

Can someone point me in the right direction? Is my thinking correct? If not how should I approach the problem?

Any help is appreciated! Thanks!

How to resolve javascript: SPClientPeoplePicker is not defined in Edge (works fine in Chrome and IE)?

I just noticed a javascript function that finds and populates people picker controls in SharePoint was not working in Edge, whereas it works fine in Chrome and IE.

In Edge I see an error in the console log related to the code below: ‘SPClientPeoplePicker’ is not defined

    var controlName = "External";     var ppDiv = $  ("[id$  ='ClientPeoplePicker'][title='" + controlName + "']");     var ppEditor = ppDiv.find("[title='" + controlName + "']");     var spPP = SPClientPeoplePicker.SPClientPeoplePickerDict[ppDiv[0].id];      ppEditor.val(cuser);     spPP.AddUnresolvedUserFromEditor(true); 

Has anyone else come across this? If so, any solutions?

Ubuntu 18.04: Duplex Long Edge printing mode selected but not working

If i choose to print a document (pdf, txt) with more than one page with Duplex “Long Edge” enable with Evince, Gedit, … on Ubuntu 18.04.x, it still print with Duplex Off.

It was working with Ubuntu 16.04 LTS and i also tested on Ubuntu 19.04 and it’s works. So the problem is on 18.04 LTS.

We use a remote printer on a Ubuntu print server 19.04.

It’s like the file sent by Ubuntu 18.04 to print server are not interpreted correctly by the print server..

Any help would be appreciated, i don’t know if the problem is with ubuntu, cups, poppler, … Thanks!


Filetype: PDF
Neither PDF renderer command line nor Ghostscript-based renderer command line found
Driver does not understand PDF input, converting to PostScript
Storing temporary files in /var/spool/cups/tmp
Starting process \”pdf-to-ps\” (generation 1)
Printer make and model: NRG MP 2352 PS3

Running command line for pstops: pstops 44555 john testfile.pdf 1 \’ cups-browsed cups-browsed-dest-printer=37\ xxx.xxx.xxx.xxx:631/MP-2352\ Duplex=DuplexNoTumble finishings=0 InputSlot=Auto job-uuid=urn:uuid:8023a1dd-8f1f-3e58-58b2-eb77f271e0d5 JobType=Normal MediaType=Auto OutputBin=Default PageSize=A4 Password=None print-quality=0 StapleLocation=None UserCode=None pdftops-max-image-resolution=300 pdftops-renderer=pdftops job-originating-host-name=xxx.xxx.xxx.xxx date-time-at-creation= date-time-at-processing= time-at-creation=1566373945 time-at-processing=1566373945\’

Found: %%BeginFeature: *Duplex None
Option: Duplex=None
Setting option
Found: %% FoomaticRIPOptionSetting: Duplex=None
Option: Duplex=None
Setting option


Proof that $G=(V,E)$ is connected, if every node has at least one adjacent edge, $|E|\ge n-1$ and $|V|=n$

Let $ G=(V,E)$ be an undirected graph without self-loops or parallel edges.

Does the statement:
If $ |V|=n, |E|\ge n-1$ and every node has at least one adjacent edge , then $ G$ is connected;

I’ve proofed it for $ |E|=n-1$ :

Per induction:
For $ \left|V\right|=1$ the graph is trivially connected.

Induction step:
Let the statement be shown for all graphs $ G=\left(V,E\right)$ where $ \left|V\right|=n-1$ and $ |E| = n-2$ .

Let further $ G=\left(V,E\right)$ with $ \left|V\right|=n$ and $ |E| = n-1$ be given.

We’re now looking for an induced sub graph $ G|_{V^\prime}$ where $ V^\prime\subset V, \left|V^\prime\right|=n-1$ , so that $ G|_{V^\prime}$ has at least $ n-2$ edges.

(Any such sub graph can have at most $ n-2 $ edges, as there’ll always be at least one edge that originally lead to the removed node)

Let’s now assume that every sub graph $ G|_{V^\prime}$ has less than $ n-2$ edges.
Then, the removed node in any sub graph would have at least $ 2$ edges.

Thus, every node must have at least $ 2$ edges, and therefore there’d have to exist at least $ n$ edges in the graph.

Therefore, there’s at least one sub graph $ G|_{V^\prime}$ with $ n-2$ edges, for which our induction assumption holds. And because there is one edge from $ G|_{V^\prime}$ to the erased edge, we get that $ G$ is connected.

Therefore, the induction is proven.

However, if I try to generalize the above proof, the same style leads to an inequality that only holds if $ |E|>|V|$ .

Therefore, if the above proof can be generalized, how would it look? If not, what’s an example where it fails?

Does Stone’s Edge for UA Stone Sorcerer work with cantrips?

At 14th Level, Stone Sorcerer’s get the ability Stone’s Edge which states:

When you cast a spell that deals damage, choose one creature damaged by that spell on the round you cast it.

Does this work with cantrips, or is it exclusive to ‘leveled’ spells only? Also, if I use booming blade and thunderous smite in one attack, does the Stone’s Edge ability stack?

JS not working properly in IE and Edge browsers

I've got a small JS-based music player on my homepage in its upper-left corner (just above the logo). And it works fine in all browsers, except IE and Edge. In those it shows NaN where the song's total time is supposed to be after the page loads. I can't attach a print-screen here, but you can either follow my site's link or here is a link to a photo-bank where it's been uploaded successfully.
But if you try to load my site in FF or Chrome, then…

JS not working properly in IE and Edge browsers

Number of ways painting graph in two colors, such that two nodes of same color are linked by edge

We are given undirected graph of $ N$ nodes and $ M$ edges, we want to count the number of possible ways to paint this graph in $ 2$ colors such that for each two nodes having the same color, there must be an edge between them.

I tried some examples on paper and I always got numbers of the form $ 2^x$ , however I couldn’t see a valid way to find such $ x$ or I couldn’t prove why this is the case.

Does this problem become easier if we are given directed acyclic graph instead of undirected one?