|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.DFS | +--com.mhhe.clrs2e.SCC.SecondDFS
Inner class to do the second DFS. It considers the vertices in order of decreasing finish times, which means that they are visited in the order in which they appear in the linked list. It also numbers them so that the vertices in each tree of the resulting depth-first forest get the same SCC number.
Field Summary | |
private int |
currentSCC
The number of the current SCC. |
private static int |
NO_SCC
Value indicating that a vertex is not yet in an SCC. |
Fields inherited from class com.mhhe.clrs2e.DFS |
dfsInfo, time |
Constructor Summary | |
SCC.SecondDFS()
Initializes currentSCC and all SCC numbers to NO_SCC . |
Method Summary | |
protected void |
finish(com.mhhe.clrs2e.AdjacencyListGraph g,
com.mhhe.clrs2e.Vertex u)
Overrides the DFS.finish(com.mhhe.clrs2e.AdjacencyListGraph, com.mhhe.clrs2e.Vertex) method to assign the
current SCC number to the vertex. |
void |
search(com.mhhe.clrs2e.AdjacencyListGraph g)
Performs the main loop of the second DFS. |
Methods inherited from class com.mhhe.clrs2e.DFS |
dfsVisit, discover, getDFSInfo, getDFSInfo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int currentSCC
private static final int NO_SCC
Constructor Detail |
public SCC.SecondDFS()
NO_SCC
.
Method Detail |
public void search(com.mhhe.clrs2e.AdjacencyListGraph g)
DFS.dfsVisit(com.mhhe.clrs2e.AdjacencyListGraph, com.mhhe.clrs2e.Vertex)
,
which in turn calls finish(com.mhhe.clrs2e.AdjacencyListGraph, com.mhhe.clrs2e.Vertex)
, which sets the SCC
numbers in the sccNumber
array.
search
in class DFS
g
- The directed graph.protected void finish(com.mhhe.clrs2e.AdjacencyListGraph g, com.mhhe.clrs2e.Vertex u)
DFS.finish(com.mhhe.clrs2e.AdjacencyListGraph, com.mhhe.clrs2e.Vertex)
method to assign the
current SCC number to the vertex.
finish
in class DFS
g
- The graph.u
- The vertex just finished.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |