public class DepthFirstAnalysis extends Object
Performs a depth-first analysis of a given Graph
, caching
information about the graph's nodes and edges. See the DFS algorithm
in the book 'Introduction to Algorithms' by Cormen, Leiserson, and
Rivest. The algorithm has been modified to group sibling nodes without
connections together during the topological sort.
Constructor and Description |
---|
DepthFirstAnalysis(Graph graph)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Collection<Edge> |
getEdges(int type)
Return all edges of the given type.
|
int |
getFinishedTime(Object node)
Return the logical time that the given node was finished in
the graph walk, or -1 if the node is not part of the graph.
|
List<Object> |
getSortedNodes()
Return the nodes in topologically-sorted order.
|
boolean |
hasNoCycles()
Test, if the analysis didn't find cycles.
|
void |
setNodeComparator(Comparator<Object> comp)
Set the comparator that should be used for ordering groups of nodes
with the same dependencies.
|
public DepthFirstAnalysis(Graph graph)
public void setNodeComparator(Comparator<Object> comp)
public List<Object> getSortedNodes()
public Collection<Edge> getEdges(int type)
Edge.TYPE_BACK
or Edge.TYPE_FORWARD
edge type.public int getFinishedTime(Object node)
public boolean hasNoCycles()
Copyright © 2006–2020 Apache Software Foundation. All rights reserved.