_inner_bellman_ford(G, sources, weight, pred, dist=None, heuristic=True)
This is an implementation of the SPFA variant. See https://en.wikipedia.org/wiki/Shortest_Path_Faster_Algorithm
List of source nodes. The shortest path from any of the source nodes will be found if multiple sources are provided.
The weight of an edge is the value returned by the function. The function must accept exactly three positional arguments: the two endpoints of an edge and the dictionary of edge attributes for that edge. The function must return a number.
dict to store a list of predecessors keyed by that node
dict to store distance from source to the keyed node If None, returned dist dict contents default to 0 for every node in the source list
Determines whether to use a heuristic to early detect negative cycles at a hopefully negligible cost.
If any of :None:None:`source`
is not in G
.
Return a node :None:None:`v`
where processing discovered a negative cycle. If no negative cycle found, return None.
Inner Relaxation loop for Bellman–Ford algorithm.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them