Class DagInCpcagIterator

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

public class DagInCpcagIterator extends Object
Given a CPDAG, lists all the DAGs in that DPCAG. In the form of an iterator-- call hasNext() to see if there's another one and next() to get it. next() will return null if there are no more.
Author:
josephramsey
  • Constructor Summary

    Constructors
    Constructor
    Description
    The given CPDAG must be a CPDAG.
    DagInCpcagIterator(Graph CPDAG, Knowledge knowledge)
    The given CPDAG must be a CPDAG.
    DagInCpcagIterator(Graph CPDAG, Knowledge knowledge, boolean allowArbitraryOrientations, boolean allowNewColliders)
    The given CPDAG must be a CPDAG.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Successive calls to this method return successive DAGs in the CPDAG, in a more or less natural enumeration of them in which an arbitrary undirected edge is picked, oriented one way, Meek rules applied, then a remaining unoriented edge is picked, oriented one way, and so on, until a DAG is obtained, and then by backtracking the other orientation of each chosen edge is tried.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DagInCpcagIterator

      public DagInCpcagIterator(Graph CPDAG)
      The given CPDAG must be a CPDAG. If it does not consist entirely of directed and undirected edges and if it is not acyclic, it is rejected.
      Parameters:
      CPDAG - The CPDAG for which DAGS are wanted. May result in cyclic outputs.
      Throws:
      IllegalArgumentException - if the CPDAG is not a CPDAG.
    • DagInCpcagIterator

      public DagInCpcagIterator(Graph CPDAG, Knowledge knowledge)
      The given CPDAG must be a CPDAG. If it does not consist entirely of directed and undirected edges and if it is not acyclic, it is rejected.
      Parameters:
      CPDAG - The CPDAG for which DAGS are wanted. May result in cyclic outputs.
      knowledge - The knowledge to be used to constrain the DAGs.
      Throws:
      IllegalArgumentException - if the CPDAG is not a CPDAG.
    • DagInCpcagIterator

      public DagInCpcagIterator(Graph CPDAG, Knowledge knowledge, boolean allowArbitraryOrientations, boolean allowNewColliders)
      The given CPDAG must be a CPDAG. If it does not consist entirely of directed and undirected edges and if it is not acyclic, it is rejected.
      Parameters:
      CPDAG - The CPDAG for which DAGS are wanted.
      knowledge - The knowledge to be used to constrain the DAGs.
      allowArbitraryOrientations - True if arbitrary orientations are allowable when reasonable ones cannot be made. May result in cyclic outputs.
      allowNewColliders - True if new colliders are allowed in teh graphs.
      Throws:
      IllegalArgumentException - if the CPDAG is not a CPDAG.
  • Method Details

    • next

      public Graph next()
      Successive calls to this method return successive DAGs in the CPDAG, in a more or less natural enumeration of them in which an arbitrary undirected edge is picked, oriented one way, Meek rules applied, then a remaining unoriented edge is picked, oriented one way, and so on, until a DAG is obtained, and then by backtracking the other orientation of each chosen edge is tried. Nonrecursive, obviously.

      Returns:
      a Graph instead of a DAG because sometimes, due to faulty CPDAGs, a cyclic graph is produced, and the end-user may need to decide what to do with it. The simplest thing is to construct a DAG (Dag(graph)) and catch an exception.
    • hasNext

      public boolean hasNext()
      Returns:
      true just in case there is still a DAG remaining in the enumeration of DAGs for this CPDAG.