/** * Computes a {@link List} of {@link Set}s, where each set contains vertices * which together form a strongly connected component within the given * graph. * * @return <code>List</code> of <code>EquivalanceClass</code>es containing the strongly * connected components */ public List<Equivalences<V>> stronglyConnectedSets() { if (stronglyConnectedSets == null) { stronglyConnectedSets = new Vector<>(); // create VertexData objects for all vertices, store them createVertexNumber(); // perform DFS for (VertexNumber<V> data : vertexToVertexNumber.values()) { if (data.getNumber() == 0) { dfsVisit(graph, data); } } vertexToVertexNumber = null; stack = null; B = null; } return stronglyConnectedSets; }
/** * Returns true if the graph instance is strongly connected. * * @return true if the graph is strongly connected, false otherwise */ public boolean isStronglyConnected() { return stronglyConnectedSets().size() == 1; }
GabowSCC<TT, DefaultEdge> inspector = new GabowSCC<>(graph); List<Equivalences<TT>> equivalenceSets = inspector.stronglyConnectedSets();
dfsVisit(graph, w);
GabowSCC<TT, DefaultEdge> inspector = new GabowSCC<>(graph); List<Equivalences<TT>> equivalenceSets = inspector.stronglyConnectedSets();
/** * Computes a {@link List} of {@link Set}s, where each set contains vertices * which together form a strongly connected component within the given * graph. * * @return <code>List</code> of <code>EquivalanceClass</code>es containing the strongly * connected components */ public List<Equivalences<V>> stronglyConnectedSets() { if (stronglyConnectedSets == null) { stronglyConnectedSets = new Vector<>(); // create VertexData objects for all vertices, store them createVertexNumber(); // perform DFS for (VertexNumber<V> data : vertexToVertexNumber.values()) { if (data.getNumber() == 0) { dfsVisit(graph, data); } } vertexToVertexNumber = null; stack = null; B = null; } return stronglyConnectedSets; }
/** * Returns true if the graph instance is strongly connected. * * @return true if the graph is strongly connected, false otherwise */ public boolean isStronglyConnected() { return stronglyConnectedSets().size() == 1; }