Class GraphLegalityCheck

java.lang.Object
edu.cmu.tetrad.search.utils.GraphLegalityCheck

public class GraphLegalityCheck extends Object
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.

  • Method Details

    • isLegalPag

      public static GraphLegalityCheck.LegalPagRet isLegalPag(Graph pag, Set<Node> selection)
      Checks if the provided Directed Acyclic Graph (PAG) is a legal PAG.
      Parameters:
      pag - The Directed Acyclic Graph (PAG) to be checked
      selection - 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

      public static GraphLegalityCheck.LegalMagRet isLegalMag(Graph mag, Set<Node> selection)
      Determines whether the given graph is a legal Mixed Ancestral Graph (MAG).
      Parameters:
      mag - the graph to be checked
      selection - 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

      public static boolean isLegalPagQuiet(Graph pag, Set<Node> selection)
      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

      public static boolean isLegalMagQuiet(Graph mag, Set<Node> selection)
      Determines whether the given graph is a legal Mixed Ancestral Graph (MAG) without providing detailed error messages.
      Parameters:
      mag - the graph to be checked
      selection - the set of nodes to be conditioned on
      Returns:
      true if the graph is a legal MAG, false otherwise