networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
_build_paths_from_predecessors(sources, target, pred)

Notes

There may be many paths between the sources and target. If there are cycles among the predecessors, this function will not produce all possible paths because doing so would produce infinitely many paths of unbounded length -- instead, we only produce simple paths.

Parameters

sources : set

Starting nodes for path.

target : node

Ending node for path.

pred : dict

A dictionary of predecessor lists, keyed by node

Raises

NetworkXNoPath

If :None:None:`target` cannot be reached from :None:None:`source`.

Returns

paths : generator of lists

A generator of all paths between source and target.

Compute all simple paths to target, given the predecessors found in pred, terminating when any source in sources is found.

See Also

all_pairs_shortest_path
all_shortest_paths
bellman_ford_path
shortest_path
single_source_shortest_path

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/generic.py#504
type: <class 'function'>
Commit: