Convert a list of edges to an adjacency list
MIT License
Converts a collection of edges in a graph to an adjacency list representation. For the more general operation on simplicial complexes, use the stars
module.
var e2a = require("edges-to-adjacency-list")
console.log(e2a([
[0, 1],
[1, 2],
[2, 3]
]))
Output:
[ [1],
[0, 2],
[1, 3],
[2]
]
npm install edges-to-adjacency-list
require("edges-to-adjacency-list")(edges[, numVertices])
Converts a collection of edges to an adjacency list representation.
edges
are the edges of the graphnumVertices
is an optional parameter giving the number of vertices in the graphReturns An array encoding the adjacency list of the graph
Note Repeated edges will be combined.
(c) 2014 Mikola Lysenko. MIT License