|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.SCC
Class to perform the Strongly-Connected-Components procedure on page 554 of Introduction to Algorithms, Second edition.
Nested Class Summary | |
private class |
SCC.FirstDFS
Inner class to do the first DFS. |
private class |
SCC.SecondDFS
Inner class to do the second DFS. |
Field Summary | |
private com.mhhe.clrs2e.SentinelDLL |
list
A list of vertices. |
private int[] |
sccNumber
The SCC number of each vertex. |
Constructor Summary | |
SCC()
|
Method Summary | |
int |
getSCCNumber(int v)
Returns the SCC number for a given vertex. |
int |
getSCCNumber(com.mhhe.clrs2e.Vertex v)
Returns the SCC number for a given vertex. |
void |
stronglyConnectedComponents(com.mhhe.clrs2e.AdjacencyListGraph g)
Computes the strongly connected components of a directed graph, filling in SCC numbers in the sccNumber array so
that sccNumber[i] is the SCC number of the vertex
whose index is i . |
private com.mhhe.clrs2e.AdjacencyListGraph |
transpose(com.mhhe.clrs2e.AdjacencyListGraph g)
Transposes a graph. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private com.mhhe.clrs2e.SentinelDLL list
private int[] sccNumber
sccNumber[i]
is
the SCC number of the vertex whose index is i
.
Valid SCC numbers start at 0.
Constructor Detail |
public SCC()
Method Detail |
public void stronglyConnectedComponents(com.mhhe.clrs2e.AdjacencyListGraph g)
sccNumber
array so
that sccNumber[i]
is the SCC number of the vertex
whose index is i
.
g
- The directed graph.private com.mhhe.clrs2e.AdjacencyListGraph transpose(com.mhhe.clrs2e.AdjacencyListGraph g)
Vertex
objects as the input graph but different
edges.
g
- The directed graph to transpose.
public int getSCCNumber(com.mhhe.clrs2e.Vertex v)
v
- The vertex for which the corresponding SCC number is
returned.public int getSCCNumber(int v)
v
- The index of the vertex for which the corresponding
SCC number is returned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |