You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions that implement Dijsktra's algorithm should throw an error when encountering negative weights. Dijkstra's algorithm does not work with negative weights. Example:
The distance from 0 to 1 is returned as 3, but in fact it is 0. Thus the function is giving incorrect results without warnings.
There are other algorithms which can handle negative weights when computing graph distances, assuming the graph has no cycles along which the weights add up to negative numbers. But Dijkstra's can't.
The text was updated successfully, but these errors were encountered:
For reference, here's a drawing of this graph, produced with another system:
I was unable to get a good drawing of this graph with mpl_draw() because it cannot handle multiple edges that connect the same vertices, even when the two edges are directed and running in opposite directions (i.e. not a multigraph). While it is possible to use `connectionstyle='arc3,rad=0.2', as in the documentation, to separate the edges, the labels will still be drawn on top of each other.
graphviz_draw(g) also seems to misrender this graph. I get this:
Functions that implement Dijsktra's algorithm should throw an error when encountering negative weights. Dijkstra's algorithm does not work with negative weights. Example:
The distance from 0 to 1 is returned as 3, but in fact it is 0. Thus the function is giving incorrect results without warnings.
There are other algorithms which can handle negative weights when computing graph distances, assuming the graph has no cycles along which the weights add up to negative numbers. But Dijkstra's can't.
The text was updated successfully, but these errors were encountered: