graph.mixedOrientedPath

pyagrum.graph.mixedOrientedPath(g, source, target)

A shortest path made of arcs (followed in their direction) and edges between two nodes (family AE).

Parameters:
  • g (MixedGraph | PDAG | ChainGraph | CPDAG | MPDAG | EssentialGraph) – the graph

  • source (int | str) – the first node of the path

  • target (int | str) – the last node of the path

Returns:

the nodes of the path, from source to target, or None if there is no such path

Return type:

list[int] | None

Example

import pyagrum as gum
import pyagrum.graph as gg

g = gum.fastPDAG("A->B-C")
gg.mixedOrientedPath(g, "A", "C")
# [0, 1, 2]
print(gg.mixedOrientedPath(g, "C", "A"))
# None