pywhy_graphs.algorithms.valid_mag#

pywhy_graphs.algorithms.valid_mag(G: ADMG, L: set | None = None, S: set | None = None)[source]#

Checks if the provided graph is a valid maximal ancestral graph (MAG).

A valid MAG as defined in [1] is a mixed edge graph that only has directed and bi-directed edges, no directed or almost directed cycles and no inducing paths between any two non-adjacent pair of nodes.

Parameters:
GGraph

The graph.

Returns:
is_validbool

A boolean indicating whether the provided graph is a valid MAG or not.