Small graph library for directed and undirected graphs.
npm install tinygraphsSmall graph library for directed and undirected graphs.
Provides very basic functionality for directed graphs, mainly calculating reachable vertices.
``ts`
const dg = new DirectedGraph();
dg.addEdge( 0, 1 );
dg.addEdge( 1, 2 );
dg.addEdge( 2, 3 );
dg.reachableVertices( 0 ); // [ 0, 1, 2, 3 ]
API:
`text`
DirectedGraph
-------------
edgeArray()
hasEdge(from, to)
addEdge(from, to)
reachableVertices(from)
colourise()
This class is almost identical to DirectedGraph except that addEdge`
adds an edge in both directions.
* 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.