rustworkx.has_path#
- has_path(graph, source, target, as_undirected=False)[source]#
Checks if a path exists between a source and target node
- Parameters:
graph – The input graph to use. Can either be a
PyGraph
orPyDiGraph
source (int) – The node index to find paths from
target (int) – The index of the target node
as_undirected (bool) – If set to true the graph will be treated as undirected for finding existence of a path. This only works with a
PyDiGraph
input forgraph
- Returns:
True if a path exists, False if not
- Return type:
bool