Class PagCache

java.lang.Object
edu.cmu.tetrad.util.PagCache

public class PagCache extends Object
A cache for storing PAGs so that the only need to be calculated once per DAG.
  • Method Summary

    Modifier and Type
    Method
    Description
    getDag(Graph graph)
    Returns the Directed Acyclic Graph (DAG) corresponding to the given graph if it is a PAG that has previously been converted from a DAG.
    static PagCache
    Returns the singleton instance of the PagCache.
    @NotNull Graph
    getPag(Graph graph)
    Returns the PAG (Partial Ancestral Graph) corresponding to the given DAG (Directed Acyclic Graph).
    getPag(Graph graph, Knowledge knowledge, boolean verbose)
    Returns the PAG (Partial Ancestral Graph) corresponding to the given DAG (Directed Acyclic Graph).

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstance

      public static PagCache getInstance()
      Returns the singleton instance of the PagCache.
      Returns:
      the singleton instance of PagCache.
    • getPag

      @NotNull public @NotNull Graph getPag(Graph graph)
      Returns the PAG (Partial Ancestral Graph) corresponding to the given DAG (Directed Acyclic Graph). If the conversion has already been performed earlier, the cached result will be returned. Otherwise, the DAG will be converted to a PAG, cached, and then returned.
      Parameters:
      graph - the input DAG to be transformed into a PAG
      Returns:
      the corresponding PAG of the input DAG
      Throws:
      IllegalArgumentException - if the input graph is not a DAG
    • getPag

      public Graph getPag(Graph graph, Knowledge knowledge, boolean verbose)
      Returns the PAG (Partial Ancestral Graph) corresponding to the given DAG (Directed Acyclic Graph). If the conversion has already been performed earlier, the cached result will be returned. Otherwise, the DAG will be converted to a PAG, cached, and then returned.
      Parameters:
      graph - the input DAG to be transformed into a PAG
      knowledge - the knowledge that should be used for the conversion
      verbose - whether to print verbose output
      Returns:
      the corresponding PAG of the input DAG
      Throws:
      IllegalArgumentException - if the input graph is not a DAG
    • getDag

      public Graph getDag(Graph graph)
      Returns the Directed Acyclic Graph (DAG) corresponding to the given graph if it is a PAG that has previously been converted from a DAG. Otherwise, if it is a DAG, the input graph is returned as is. Otherwise, null is returned.
      Parameters:
      graph - the input graph to be checked and potentially converted to a DAG
      Returns:
      the corresponding DAG if the input graph is a legal DAG or present in cache; null otherwise