tinygraphs
TypeScript icon, indicating that this package has built-in type declarations

0.10.0 • Public • Published

tinygraphs

Small graph library for directed and undirected graphs.

DirectedGraph

Provides very basic functionality for directed graphs, mainly calculating reachable vertices.

const dg = new DirectedGraph();
dg.addEdge( 0, 1 );
dg.addEdge( 1, 2 );
dg.addEdge( 2, 3 );
dg.reachableVertices( 0 ); // [ 0, 1, 2, 3 ]

API:

DirectedGraph
-------------
edgeArray()
hasEdge(from, to)
addEdge(from, to)
reachableVertices(from)
colourise()

UndirectedGraph

This class is almost identical to DirectedGraph except that addEdge adds an edge in both directions.

Changelog

  • v0.10.0 (2023-02-21)
    • Added: DirectedGraph now has source code comments, readme (this file) improved
    • Changed: Update to latest TypeScript version
  • v0.9.0 (2019-04-02)
    • Previous release. Not sure if it worked correctly.

Readme

Keywords

Package Sidebar

Install

npm i tinygraphs

Weekly Downloads

263

Version

0.10.0

License

mit

Unpacked Size

9.84 kB

Total Files

8

Last publish

Collaborators

  • granjow