causaldag.classes.dag.DAG.moral_graph¶
-
DAG.
moral_graph
()[source]¶ Return the (undirected) moral graph of this DAG, i.e., the graph with the parents of all nodes made adjacent.
Returns: Moral graph of this DAG. Return type: UndirectedGraph Examples
>>> import causaldag as cd >>> d = cd.DAG(arcs={(1, 3), (2, 3)}) >>> ug = d.moral_graph() >>> ug.edges {frozenset({1, 3}), frozenset({2, 3}), frozenset({1, 2})}