networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
is_reachable(G, s, t)

This function is more theoretically efficient than the reachability checks than the shortest path algorithms in networkx.algorithms.shortest_paths .

The given graph must be a tournament, otherwise this function's behavior is undefined.

Notes

Although this function is more theoretically efficient than the generic shortest path functions, a speedup requires the use of parallelism. Though it may in the future, the current implementation does not use parallelism, thus you may not see much of a speedup.

This algorithm comes from [1].

Parameters

G : NetworkX graph

A directed graph representing a tournament.

s : node

A node in the graph.

t : node

A node in the graph.

Returns

bool

Whether there is a path from s to t in G.

Decides whether there is a path from s to t in the tournament.

Examples

>>> from networkx.algorithms import tournament
... G = nx.DiGraph([(1, 0), (1, 3), (1, 2), (2, 3), (2, 0), (3, 0)])
... tournament.is_reachable(G, 1, 3) True
>>> tournament.is_reachable(G, 3, 2)
False
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/tournament.py#255
type: <class 'function'>
Commit: