Package edu.cmu.tetrad.search.utils
Class DagInCpcagIterator
java.lang.Object
edu.cmu.tetrad.search.utils.DagInCpcagIterator
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.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
ConstructorsConstructorDescriptionDagInCpcagIterator
(Graph CPDAG) 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 TypeMethodDescriptionboolean
hasNext()
Returns true just in case there is still a DAG remaining in the enumeration of DAGs for this CPDAG.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.
-
Constructor Details
-
DagInCpcagIterator
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
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
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.- Returns:
- true just in case there is still a DAG remaining in the enumeration of DAGs for this CPDAG.
-