Package edu.cmu.tetrad.search.utils
Class GraphLegalityCheck
java.lang.Object
edu.cmu.tetrad.search.utils.GraphLegalityCheck
The GraphLegalityCheck class provides utility methods for validating the legality of specific types of graphs,
including Directed Acyclic Graphs (PAGs) and Mixed Ancestral Graphs (MAGs). It includes methods to assess the
legality of PAGs and MAGs both explicitly, with detailed results, and quietly, returning only a boolean outcome.
The methods in this class can be utilized to verify structural and conditional validity of graphs in various applications, such as causal inference and graphical modeling.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStores a result for checking whether a graph is a legal MAG--(a) whether it is (a boolean), and (b) the reason why it is not, if it is not (a String).static classStores a result for checking whether a graph is a legal PAG--(a) whether it is (a boolean), and (b) the reason why it is not, if it is not (a String). -
Method Summary
Modifier and TypeMethodDescriptionisLegalMag(Graph mag, Set<Node> selection) Determines whether the given graph is a legal Mixed Ancestral Graph (MAG).static booleanisLegalMagQuiet(Graph mag, Set<Node> selection) Determines whether the given graph is a legal Mixed Ancestral Graph (MAG) without providing detailed error messages.isLegalPag(Graph pag, Set<Node> selection) Checks if the provided Directed Acyclic Graph (PAG) is a legal PAG.static booleanisLegalPagQuiet(Graph pag, Set<Node> selection) Determines whether the provided Partial Ancestral Graph (PAG) is a legal PAG without providing detailed error messages.
-
Method Details
-
isLegalPag
Checks if the provided Directed Acyclic Graph (PAG) is a legal PAG.- Parameters:
pag- The Directed Acyclic Graph (PAG) to be checkedselection- The set of nodes to be conditioned on- Returns:
- A LegalPagRet object indicating whether the PAG is legal or not, along with a reason if it is not legal.
-
isLegalMag
Determines whether the given graph is a legal Mixed Ancestral Graph (MAG).- Parameters:
mag- the graph to be checkedselection- the set of nodes to be conditioned on- Returns:
- a LegalMagRet object indicating whether the graph is legal and providing an error message if it is not
-
isLegalPagQuiet
Determines whether the provided Partial Ancestral Graph (PAG) is a legal PAG without providing detailed error messages.- Parameters:
pag- The Partial Ancestral Graph (PAG) to be checked.selection- The set of nodes to be conditioned on.- Returns:
- true if the PAG is legal, false otherwise.
-
isLegalMagQuiet
Determines whether the given graph is a legal Mixed Ancestral Graph (MAG) without providing detailed error messages.- Parameters:
mag- the graph to be checkedselection- the set of nodes to be conditioned on- Returns:
- true if the graph is a legal MAG, false otherwise
-