Computes strongly connected components of a directed graph
Given a directed graph, splits it into strongly connected components.
var scc = require"strongly-connected-components"var adjacencyList =4 // 002 // 113 // 22 // 31 // 446 // 552 // 6763 // 7console.logsccadjacencyList
npm install strongly-connected-components
Computes the strongly connected components of a graph using Tarjan's algorithm.
adjacencyListis an array of lists representing the directed edges of the graph
Returns An object containing:
components: an array of arrays representing the partitioning of the vertices in the graph into connected components.
adjacencyList: an array lists representing the directed edges of the directed acyclic graph between the strongly connected components
(c) 2013 Mikola Lysenko. MIT License. Based on the implementation of Tarjan's algorithm on Wikipedia.