networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
_dijkstra_multisource(G, sources, weight, pred=None, paths=None, cutoff=None, target=None)

Notes

The optional predecessor and path dictionaries can be accessed by the caller through the original pred and paths objects passed as arguments. No need to explicitly return pred or paths.

Parameters

G : NetworkX graph
sources : non-empty iterable of nodes

Starting nodes for paths. If this is just an iterable containing a single node, then all paths computed by this function will start from that node. If there are two or more nodes in this iterable, the computed paths may begin from any one of the start nodes.

weight: function :

Function with (u, v, data) input that returns that edges weight

pred: dict of lists, optional(default=None) :

dict to store a list of predecessors keyed by that node If None, predecessors are not stored.

paths: dict, optional (default=None) :

dict to store the path list from source to each node, keyed by node. If None, paths are not stored.

target : node label, optional

Ending node for path. Search is halted when target is found.

cutoff : integer or float, optional

Length (sum of edge weights) at which the search is stopped. If cutoff is provided, only return paths with summed weight <= cutoff.

Raises

NodeNotFound

If any of :None:None:`sources` is not in G.

Returns

distance : dictionary

A mapping from node to shortest distance to that node from one of the source nodes.

Uses Dijkstra's algorithm to find shortest weighted paths

Examples

See :

Local connectivity graph

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


GitHub : /networkx/algorithms/shortest_paths/weighted.py#764
type: <class 'function'>
Commit: