It aims at supporting various kinds of graphs with the same unified interface.
graphology graph can therefore be directed, undirected or mixed and can be simple or support parallel edges.
Along with those specifications, one will also find a standard library full of graph theory algorithms and common utilities such as graph generators, layouts etc.
To install the reference implementation:
npm install --save graphology
The source of the reference implementation can be found on this github repository.
const Graph = require('graphology'); const graph = new Graph(); graph.addNode('John'); graph.addNode('Martha'); graph.addEdge('John', 'Martha'); console.log('Number of nodes', graph.order); console.log('Number of edges', graph.size); console.log('Nodes', graph.nodes());
Miscellaneous assertions (same nodes, same edges etc.).
Various centrality measures (degree, betweenness etc.).
Louvain method for community detection.
Connected components (strong, weak etc.).
Graph generators (random graphs, complete graphs etc.).
Parsers & writers for the GEXF file format.
Basic graph layouts (random, circle etc.).
ForceAtlas2 layout algorithm.
Modularity, density etc.
Graph unary & binary operators (reverse, union, intersection etc.)
Shortest path functions (Dijkstra, A* etc.)
Miscellaneous utils used by most of the other modules.
graphology merely is a specification so that anyone can implement it its own way if necessary while keeping the advantages of being able to use the standard library.
Graphs are complex structures and, while we designed the reference implementation to handle most common cases with good performance, one will always be able to implement the present specifications in a more performant fashion for very specific use cases.
It is therefore possible to test your custom implementation against the specifications' unit tests.
Directions about this can be found here.