NetworkX

Previous topic

networkx.bidirectional_shortest_path

Next topic

networkx.predecessor

networkx.dijkstra_predecessor_and_distance

dijkstra_predecessor_and_distance(G, source)

Returns two dictionaries representing a list of predecessors of a node and the distance to each node respectively.

Parameters:

G : NetworkX graph

source : node label

Starting node for path

Notes

The list of predecessors contains more than one element only when there are more than one shortest paths to the key node.

This routine is intended for use with the betweenness centrality algorithms in centrality.py.