Socket
Book a DemoInstallSign in
Socket

connected-components

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connected-components

Finds connected components of an undirected graph

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

connected-components

Enumerate all connected components in an undirected graph.

Example

var cc = require("connected-components")

var adjList = [
  [],
  [2],
  [1],
  [4, 5],
  [3],
  [3]
]

console.log(cc(adjList))

Output:

[ [0], [1, 2], [3, 4, 5] ]

Install

npm install connected-components

API

require("connected-components")(adjacencyList)

Returns a list of connected components for the given graph.

  • adjacencyList is an adjacency list representation of a graph

Returns A list of connected components in the graph

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

connected

FAQs

Package last updated on 29 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts