This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.


has_path(graph, source, target, as_undirected=False)[source]#

Checks if a path exists between a source and target node

  • graph – The input graph to use. Can either be a PyGraph or PyDiGraph

  • 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 for graph


True if a path exists, False if not

Return type: