graph.hasDirectedCycle
- pyagrum.graph.hasDirectedCycle(g)
Whether the arcs of a graph (family A) contain a directed cycle.
- Parameters:
g (
DiGraph | DAG | MixedGraph | PDAG | ChainGraph | CPDAG | MPDAG | EssentialGraph) – the graph (its edges are ignored)- Returns:
True if a directed cycle exists
- Return type:
bool
Example
import pyagrum as gum
import pyagrum.graph as gg
gg.hasDirectedCycle(gum.fastDiGraph("A->B->C->A"))
# True
gg.hasDirectedCycle(gum.fastMixedGraph("A->B-C-A")) # the edges are ignored
# False