JSPM

edges-to-adjacency-list

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20158
  • Score
    100M100P100Q163613F
  • License MIT

Convert a list of edges to an adjacency list

Package Exports

  • edges-to-adjacency-list

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (edges-to-adjacency-list) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

edges-to-adjacency-list

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.

Example

var e2a = require("edges-to-adjacency-list")

console.log(e2a([
  [0, 1],
  [1, 2],
  [2, 3]
]))

Output:

[ [1],
  [0, 2],
  [1, 3],
  [2]
]

Install

npm install edges-to-adjacency-list

API

require("edges-to-adjacency-list")(edges[, numVertices])

Converts a collection of edges to an adjacency list representation.

  • edges are the edges of the graph
  • numVertices is an optional parameter giving the number of vertices in the graph

Returns An array encoding the adjacency list of the graph

Note Repeated edges will be combined.

Credits

(c) 2014 Mikola Lysenko. MIT License