Package com.jgalgo.alg.connect
Class StronglyConnectedComponentsAlgoAbstract
java.lang.Object
com.jgalgo.alg.connect.StronglyConnectedComponentsAlgoAbstract
- All Implemented Interfaces:
StronglyConnectedComponentsAlgo
- Direct Known Subclasses:
StronglyConnectedComponentsPathBasedDfs,StronglyConnectedComponentsTarjan
public abstract class StronglyConnectedComponentsAlgoAbstract
extends Object
implements StronglyConnectedComponentsAlgo
Abstract class for computing strongly connected components in a graph.
The class implements the interface by solving the problem on the index graph and then maps the results back to the original graph. The implementation for index graphs is abstract and left to the subclasses.
- Author:
- Barak Ugav
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V,E> VertexPartition <V, E> findStronglyConnectedComponents(Graph<V, E> g) Find all strongly connected components in a graph.<V,E> boolean isStronglyConnected(Graph<V, E> g) Check whether a graph is strongly connected.
-
Constructor Details
-
StronglyConnectedComponentsAlgoAbstract
public StronglyConnectedComponentsAlgoAbstract()Default constructor.
-
-
Method Details
-
findStronglyConnectedComponents
Description copied from interface:StronglyConnectedComponentsAlgoFind all strongly connected components in a graph.A strongly connected component is a maximal set of vertices for which for any pair of vertices \(u, v\) in the set there exist a path from \(u\) to \(v\) and from \(v\) to \(u\).
If
gisIntGraph, the returned object isIVertexPartition.- Specified by:
findStronglyConnectedComponentsin interfaceStronglyConnectedComponentsAlgo- Type Parameters:
V- the vertices typeE- the edges type- Parameters:
g- a graph- Returns:
- a result object containing the partition of the vertices into strongly connected components
-
isStronglyConnected
Description copied from interface:StronglyConnectedComponentsAlgoCheck whether a graph is strongly connected.A graph is strongly connected if there is a path from any vertex to any other vertex. Namely if the the whole graph is a single strongly connected component.
- Specified by:
isStronglyConnectedin interfaceStronglyConnectedComponentsAlgo- Type Parameters:
V- the vertices typeE- the edges type- Parameters:
g- a graph- Returns:
trueif the graph is strongly connected,falseotherwise
-