public class StronglyConnectedComponentDetector<T>
extends java.lang.Object
This algorithm allows to detect all cycles in dependencies that prevent topological sorting.
This detector evaluates the graph lazily and won't reflect the modifications in the graph after initial evaluation.
Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.util.Set<T>> |
components |
private int[] |
dfn |
private T[] |
elements |
private com.google.common.graph.Graph<T> |
graph |
private java.util.Map<T,java.lang.Integer> |
ids |
private int[] |
low |
private java.util.BitSet |
onStack |
private int[] |
stack |
private int |
top |
Constructor and Description |
---|
StronglyConnectedComponentDetector(com.google.common.graph.Graph<T> graph) |
Modifier and Type | Method and Description |
---|---|
private void |
calculate() |
private void |
dfs(int now,
int depth) |
java.util.Set<java.util.Set<T>> |
getComponents() |
private final com.google.common.graph.Graph<T> graph
private java.util.Map<T,java.lang.Integer> ids
private T[] elements
private int[] dfn
private int[] low
private int[] stack
private int top
private java.util.BitSet onStack
private java.util.Set<java.util.Set<T>> components
public StronglyConnectedComponentDetector(com.google.common.graph.Graph<T> graph)
public java.util.Set<java.util.Set<T>> getComponents()
private void calculate()
private void dfs(int now, int depth)