3.1.8. pywhy_graphs.algorithms.pag_to_mag#
- pywhy_graphs.algorithms.pag_to_mag(graph)[source]#
Sample a MAG from a PAG using Zhang’s algorithm.
Using the algorithm defined in Theorem 2 of [1], which turns all o-> edges to -> and -o edges to ->, then it converts the graph into a DAG with no unshielded colliders using the meek rules.
- Parameters:
- GGraph
The PAG.
- Returns:
- magGraph
The MAG constructed from the PAG.