Partial Directed Acyclic Graph (PDAG)

class pgmpy.base.PDAG(directed_ebunch=[], undirected_ebunch=[], latents=[])[source]

Class for representing PDAGs (also known as CPDAG). PDAGs are the equivalence classes of DAGs and contain both directed and undirected edges.

Note: In this class, undirected edges are represented using two edges in both direction i.e. an undirected edge between X - Y is represented using X -> Y and X <- Y.

copy()[source]

Returns a copy of the object instance.

Returns:

Copy of PDAG – Returns a copy of self.

Return type:

pgmpy.dag.PDAG

to_dag()[source]

Returns one possible DAG which is represented using the PDAG.

Return type:

Returns an instance of DAG.

Examples

References

[1] Dor, Dorit, and Michael Tarsi. “A simple algorithm to construct a consistent extension of a partially oriented graph.” Technicial Report R-185, Cognitive Systems Laboratory, UCLA (1992): 45.

to_graphviz()[source]

Retuns a pygraphviz object for the DAG. pygraphviz is useful for visualizing the network structure.

Examples

>>> from pgmpy.utils import get_example_model
>>> model = get_example_model('alarm')
>>> model.to_graphviz()
<AGraph <Swig Object of type 'Agraph_t *' at 0x7fdea4cde040>>