java.lang.Object
org.jhotdraw8.graph.algo.StronglyConnectedComponentsAlgo
Computes the sets of strongly connected components in a directed graph.
References:
- Stackoverflow. Non-recursive version of Tarjan's algorithm. Copyright Ivan Stoev. CC BY-SA 4.0 license.
- stackoverflow.com
- Wikipedia. Tarjan's strongly connected components algorithm
- wikipedia.org
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindStronglyConnectedComponents(@NonNull Collection<? extends V> vertices, @NonNull Function<V, Iterable<? extends V>> nextNodeFunction) Returns all strongly connected components in the specified graph.findStronglyConnectedComponents(@NonNull DirectedGraph<V, A> graph) Returns all strongly connected components in the specified graph.
-
Constructor Details
-
StronglyConnectedComponentsAlgo
public StronglyConnectedComponentsAlgo()
-
-
Method Details
-
findStronglyConnectedComponents
public <V,A> @NonNull List<List<V>> findStronglyConnectedComponents(@NonNull DirectedGraph<V, A> graph) Returns all strongly connected components in the specified graph.- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
graph- the graph- Returns:
- set of strongly connected components (sets of vertices).
-
findStronglyConnectedComponents
public <V> @NonNull List<List<V>> findStronglyConnectedComponents(@NonNull Collection<? extends V> vertices, @NonNull Function<V, Iterable<? extends V>> nextNodeFunction) Returns all strongly connected components in the specified graph.- Type Parameters:
V- the vertex data type- Parameters:
vertices- the vertices of the graphnextNodeFunction- returns the next nodes of a given node- Returns:
- set of strongly connected components (sets of vertices).
-