V - vertexW - weightpublic class Tarjan<V,W extends java.lang.Number> extends java.lang.Object implements VisitSCC<V,W>, VisitTopological<V,W>
| Constructor and Description |
|---|
Tarjan() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<java.util.Collection<V>> |
getSCC()
Return the latest calculated strongly connected components of the graph.
|
java.util.List<V> |
getTopologicalSort()
Return the latest calculated Topological sort of the graph.
If the latest visited graph is not a DAG, it will return null. |
VisitInfo<V> |
visit(Graph<V,W> graph,
V source,
java.util.function.Consumer<V> visit)
This particular visit strategy use only the graph and the visit, so the source param is not needed.
|
public java.util.Collection<java.util.Collection<V>> getSCC()
VisitSCCpublic java.util.List<V> getTopologicalSort()
VisitTopologicalgetTopologicalSort in interface VisitTopological<V,W extends java.lang.Number>public VisitInfo<V> visit(Graph<V,W> graph, V source, java.util.function.Consumer<V> visit) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
visit in interface VisitStrategy<V,W extends java.lang.Number>graph - the graph to visitsource - not neededvisit - the function to apply at each vertex when they are visitedjava.lang.NullPointerException - if the graph is nulljava.lang.IllegalArgumentException - doesn't throw this