public class Kosaraju
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private GraphAnalysis |
graphAnalysis
Graph properties for quick reference.
|
private Graph |
inputGraph
Input Graph under analysis
|
private java.util.List<java.util.List<Actor>> |
stronglyConnectedComponents
List of strongly connected components
|
Constructor and Description |
---|
Kosaraju(Graph inputGraph)
Initialize Kosaraju algorithm instance to find strongly connected
components.
|
Modifier and Type | Method and Description |
---|---|
private void |
calculateStronglyConnectedComponents()
Find strongly connected components.
|
java.util.List<java.util.List<Actor>> |
getStronglyConnectedComponents()
Get list of strongly connected components
|
boolean |
isStronglyConnected()
Check if there are any strongly connected components in the graph.
|
private void |
markReachableNodes(Actor node,
Graph g,
java.util.Map<Actor,java.lang.Integer> result,
int label)
Recursively marks all nodes reachable from the given node by a DFS with
the current label.
|
private Graph inputGraph
private GraphAnalysis graphAnalysis
private java.util.List<java.util.List<Actor>> stronglyConnectedComponents
public Kosaraju(Graph inputGraph)
inputGraph
- input graphpublic java.util.List<java.util.List<Actor>> getStronglyConnectedComponents()
public boolean isStronglyConnected()
private void calculateStronglyConnectedComponents()
private void markReachableNodes(Actor node, Graph g, java.util.Map<Actor,java.lang.Integer> result, int label)
node
- The starting point of the search.g
- The graph in which to run the search.result
- A map in which to associate nodes with labels.label
- The label that we should assign each node in this SCC.