graph.consistentExtension

pyagrum.graph.consistentExtension(g)

A consistent extension of a partially directed graph: a DAG with the same skeleton, the same arcs and the same v-structures.

Parameters:

g (PDAG | ChainGraph | CPDAG | MPDAG | EssentialGraph) – the graph

Returns:

a consistent extension, or None if there is none (never None for a CPDAG or an MPDAG)

Return type:

pyagrum.DAG | None

References

D. Dor, M. Tarsi. A simple algorithm to construct a consistent extension of a partially oriented graph. UCLA Cognitive Systems Laboratory, Technical Report R-185, 1992.

Example

import pyagrum as gum
import pyagrum.graph as gg

gg.consistentExtension(gum.fastPDAG("A->B-C")).arcs()
# {(0, 1), (1, 2)}
print(gg.consistentExtension(gum.fastPDAG("A->B-C;D->C")))  # a new v-structure is unavoidable
# None