DiGraph.hasDirectedPath

DiGraph.hasDirectedPath(_from, to)

Check if a directedpath exists between from and to.

Parameters:
  • from (int) – the id of the first node of the (possible) path

  • to (int) – the id of the last node of the (possible) path

  • _from (int)

Returns:

True if the directed path exists

Return type:

bool

Example

import pyagrum as gum

g = gum.fastDiGraph("A->B->C")
g.hasDirectedPath(0, 2)
# True
g.hasDirectedPath(2, 0)
# False

Used by

DiGraph, ChainGraph, DAG, MixedGraph, PDAG

Inheritance diagram of pyagrum.DiGraph, pyagrum.ChainGraph, pyagrum.DAG, pyagrum.MixedGraph, pyagrum.PDAG