Class StronglyConnectedComponentsGraph<V>
- Type Parameters:
V- vertex type of the original graph
- All Implemented Interfaces:
Serializable, Cloneable, org.jgrapht.Graph<Integer,Integer>
-
Field Summary
Fields inherited from interface org.jgrapht.Graph
DEFAULT_EDGE_WEIGHT -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates an empty strongly connected components graph.<E>StronglyConnectedComponentsGraph(org.jgrapht.Graph<V, E> graph) Construct the StronglyConnectedComponentsGraph of the specified graph -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(int vertex, Set<V> vertices) Registers one strongly connected component.voidaddEdge(int tail, int head) Adds an edge between two component vertices.int[]computeLayers(Iterable<Integer> sources, boolean direction) Computes graph layers from the given sources.getComponent(int vertex) Returns the original vertices contained in one component.intReturns the number of strongly connected components.getSinks()Returns the sink components of this component graph.Returns the source components of this component graph.Methods inherited from class org.jgrapht.graph.DefaultDirectedGraph
createBuilder, createBuilderMethods inherited from class org.jgrapht.graph.AbstractBaseGraph
addEdge, addEdge, addVertex, addVertex, clone, containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeSource, getEdgeSupplier, getEdgeTarget, getEdgeWeight, getType, getVertexSupplier, incomingEdgesOf, inDegreeOf, iterables, outDegreeOf, outgoingEdgesOf, removeEdge, removeEdge, removeVertex, setEdgeSupplier, setEdgeWeight, setVertexSupplier, vertexSetMethods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, equals, hashCode, removeAllEdges, removeAllEdges, removeAllEdges, removeAllVertices, toString, toStringFromSetsMethods inherited from interface org.jgrapht.Graph
containsEdge, removeAllEdges, removeAllEdges, removeAllVertices, setEdgeWeight
-
Constructor Details
-
StronglyConnectedComponentsGraph
public StronglyConnectedComponentsGraph()Creates an empty strongly connected components graph. -
StronglyConnectedComponentsGraph
Construct the StronglyConnectedComponentsGraph of the specified graph- Type Parameters:
E- edge type of the original graph- Parameters:
graph- the graph to condense into strongly connected components
-
-
Method Details
-
addEdge
public void addEdge(int tail, int head) Adds an edge between two component vertices.- Parameters:
tail- the source component indexhead- the target component index
-
addComponent
-
getComponent
-
getSources
-
getSinks
-
getNbrComponents
public int getNbrComponents()Returns the number of strongly connected components.- Returns:
- the number of components
-
computeLayers
Computes graph layers from the given sources.- Parameters:
sources- the starting componentsdirection- if true, following the direction of the edges, otherwise follows the reverse direction.- Returns:
- an array of int containing the layer number of each components of this graph.
-