Package edu.cmu.tetrad.search.utils
Class DagIterator
java.lang.Object
edu.cmu.tetrad.search.utils.DagIterator
Given a graph, lists all DAGs that result from directing the undirected edges in that graph every possible way. Uses
a Meek-algorithm-type method.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
Returns true just in case there is still a DAG remaining in the enumeration of DAGs for this pattern.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
-
DagIterator
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
- aGraph
object- 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 patterns, 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 pattern.- Returns:
- true just in case there is still a DAG remaining in the enumeration of DAGs for this pattern.
-