tarjan
public <N,E> List<List<String>> tarjan(Graph<N,E> graph)
This function is an implementation of Tarjan's algorithm which finds all strongly connected components in the directed graph g. Each strongly connected component is composed of nodes that can reach all other nodes in the component via directed edges. A strongly connected component can consist of a single node if that node cannot both reach and be reached by any other specific node in the graph. Components of more than one node are guaranteed to have at least one cycle.
- 类型参数:
N - node data type
E - edge data type
- 参数:
graph - directed graph
- 返回:
- This function returns an array of components. Each component is itself an array that contains the ids of all nodes in the component.