Class GraphTraversal
- java.lang.Object
-
- net.automatalib.util.graph.traversal.GraphTraversal
-
public final class GraphTraversal extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intNO_LIMIT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <N,E,D>
booleanbreadthFirst(IndefiniteGraph<N,E> graph, int limit, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a breadth-first fashion.static <N,E,D>
booleanbreadthFirst(IndefiniteGraph<N,E> graph, int limit, N initialNode, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a breadth-first fashion.static <N,E,D>
voidbreadthFirst(IndefiniteGraph<N,E> graph, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a breadth-first fashion.static <N,E,D>
voidbreadthFirst(IndefiniteGraph<N,E> graph, N initialNode, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a breadth-first fashion.static <N,E>
Iterator<N>breadthFirstIterator(IndefiniteGraph<N,E> graph, Collection<? extends N> start)Returns anIteratorfor the (reachable) nodes of the given graph in breadth-first order.static <N,E>
Iterable<N>breadthFirstOrder(IndefiniteGraph<N,E> graph, Collection<? extends N> start)Returns anIterablefor the (reachable) nodes of the given graph in breadth-first order.static <N,E,D>
booleandepthFirst(IndefiniteGraph<N,E> graph, int limit, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a breadth-first fashion.static <N,E,D>
booleandepthFirst(IndefiniteGraph<N,E> graph, int limit, N initialNode, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a depth-first fashion.static <N,E,D>
voiddepthFirst(IndefiniteGraph<N,E> graph, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a depth-first fashion.static <N,E,D>
voiddepthFirst(IndefiniteGraph<N,E> graph, N initialNode, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a depth-first fashion.static <N,E>
Iterator<N>depthFirstIterator(IndefiniteGraph<N,E> graph, Collection<? extends N> start)Returns anIteratorfor the (reachable) nodes of the given graph in depth-first order.static <N,E>
Iterable<N>depthFirstOrder(IndefiniteGraph<N,E> graph, Collection<? extends N> start)Returns anIterablefor the (reachable) nodes of the given graph in depth-first order.static <N,E,D>
booleantraverse(TraversalOrder order, IndefiniteGraph<N,E> graph, int limit, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a given order.static <N,E,D>
booleantraverse(TraversalOrder order, IndefiniteGraph<N,E> graph, int limit, N initialNode, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a given order.static <N,E,D>
voidtraverse(TraversalOrder order, IndefiniteGraph<N,E> graph, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a given order.static <N,E,D>
voidtraverse(TraversalOrder order, IndefiniteGraph<N,E> graph, N initialNode, GraphTraversalVisitor<N,E,D> visitor)Traverses the given graph in a given order.
-
-
-
Field Detail
-
NO_LIMIT
public static final int NO_LIMIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
breadthFirst
public static <N,E,D> void breadthFirst(IndefiniteGraph<N,E> graph, N initialNode, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a breadth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphinitialNode- the node from which the traversal should startvisitor- the visitor
-
breadthFirst
public static <N,E,D> void breadthFirst(IndefiniteGraph<N,E> graph, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a breadth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphinitialNodes- the nodes from which the traversal should startvisitor- the visitor
-
breadthFirst
public static <N,E,D> boolean breadthFirst(IndefiniteGraph<N,E> graph, int limit, N initialNode, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a breadth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphlimit- the upper bound on the number of nodes to be visitedinitialNode- the node from which the traversal should startvisitor- the visitor- Returns:
falseif the number of explored nodes reachedlimit,trueotherwise
-
breadthFirst
public static <N,E,D> boolean breadthFirst(IndefiniteGraph<N,E> graph, int limit, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a breadth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphlimit- the upper bound on the number of nodes to be visitedinitialNodes- the nodes from which the traversal should startvisitor- the visitor- Returns:
falseif the number of explored nodes reachedlimit,trueotherwise
-
breadthFirstOrder
public static <N,E> Iterable<N> breadthFirstOrder(IndefiniteGraph<N,E> graph, Collection<? extends N> start)
Returns anIterablefor the (reachable) nodes of the given graph in breadth-first order.- Type Parameters:
N- node typeE- edge type- Parameters:
graph- the graphstart- the nodes from which the traversal should start- Returns:
- an
Iterablefor the (reachable) nodes of the given graph in breadth-first order
-
breadthFirstIterator
public static <N,E> Iterator<N> breadthFirstIterator(IndefiniteGraph<N,E> graph, Collection<? extends N> start)
Returns anIteratorfor the (reachable) nodes of the given graph in breadth-first order.- Type Parameters:
N- node typeE- edge type- Parameters:
graph- the graphstart- the nodes from which the traversal should start- Returns:
- an
Iteratorfor the (reachable) nodes of the given graph in breadth-first order
-
depthFirst
public static <N,E,D> void depthFirst(IndefiniteGraph<N,E> graph, N initialNode, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a depth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphinitialNode- the node from which the traversal should startvisitor- the visitor
-
depthFirst
public static <N,E,D> void depthFirst(IndefiniteGraph<N,E> graph, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a depth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphinitialNodes- the nodes from which the traversal should startvisitor- the visitor
-
depthFirst
public static <N,E,D> boolean depthFirst(IndefiniteGraph<N,E> graph, int limit, N initialNode, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a depth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphlimit- the upper bound on the number of nodes to be visitedinitialNode- the node from which the traversal should startvisitor- the visitor- Returns:
falseif the number of explored nodes reachedlimit,trueotherwise
-
depthFirst
public static <N,E,D> boolean depthFirst(IndefiniteGraph<N,E> graph, int limit, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a breadth-first fashion. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
graph- the graphlimit- the upper bound on the number of nodes to be visitedinitialNodes- the nodes from which the traversal should startvisitor- the visitor- Returns:
falseif the number of explored nodes reachedlimit,trueotherwise
-
depthFirstOrder
public static <N,E> Iterable<N> depthFirstOrder(IndefiniteGraph<N,E> graph, Collection<? extends N> start)
Returns anIterablefor the (reachable) nodes of the given graph in depth-first order.- Type Parameters:
N- node typeE- edge type- Parameters:
graph- the graphstart- the nodes from which the traversal should start- Returns:
- an
Iterablefor the (reachable) nodes of the given graph in depth-first order
-
depthFirstIterator
public static <N,E> Iterator<N> depthFirstIterator(IndefiniteGraph<N,E> graph, Collection<? extends N> start)
Returns anIteratorfor the (reachable) nodes of the given graph in depth-first order.- Type Parameters:
N- node typeE- edge type- Parameters:
graph- the graphstart- the nodes from which the traversal should start- Returns:
- an
Iteratorfor the (reachable) nodes of the given graph in depth-first order
-
traverse
public static <N,E,D> void traverse(TraversalOrder order, IndefiniteGraph<N,E> graph, N initialNode, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a given order. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
order- the order in which the states should be traversedgraph- the graphinitialNode- the node from which the traversal should startvisitor- the visitor
-
traverse
public static <N,E,D> void traverse(TraversalOrder order, IndefiniteGraph<N,E> graph, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a given order. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
order- the order in which the states should be traversedgraph- the graphinitialNodes- the nodes from which the traversal should startvisitor- the visitor
-
traverse
public static <N,E,D> boolean traverse(TraversalOrder order, IndefiniteGraph<N,E> graph, int limit, N initialNode, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a given order. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
order- the order in which the states should be traversedgraph- the graphlimit- the upper bound on the number of nodes to be visitedinitialNode- the node from which the traversal should startvisitor- the visitor- Returns:
falseif the number of explored nodes reachedlimit,trueotherwise
-
traverse
public static <N,E,D> boolean traverse(TraversalOrder order, IndefiniteGraph<N,E> graph, int limit, Collection<? extends N> initialNodes, GraphTraversalVisitor<N,E,D> visitor)
Traverses the given graph in a given order. The traversal is steered by the specified visitor.- Type Parameters:
N- node typeE- edge typeD- (user) data type- Parameters:
order- the order in which the states should be traversedgraph- the graphlimit- the upper bound on the number of nodes to be visitedinitialNodes- the nodes from which the traversal should startvisitor- the visitor- Returns:
falseif the number of explored nodes reachedlimit,trueotherwise
-
-