Graphology

A robust & multipurpose Graph object for JavaScript & TypeScript.

README

Build Status DOI

Graphology


graphology is a robust & multipurpose Graph object for JavaScript and TypeScript.

It aims at supporting various kinds of graphs with the same unified interface.

A graphology graph can therefore be directed, undirected or mixed, allow self-loops or not, and can be simple or support parallel edges.

Along with this Graph object, one will also find a comprehensive standard library full of graph theory algorithms and common utilities such as graph generators, layouts, traversals etc.

Finally, graphology graphs are able to emit a wide variety of events, which makes them ideal to build interactive renderers for the browser. It is for instance used by sigma.js as its data backend.

Installation


To install graphology using npm, run the following command:

  1. ```
  2. npm install graphology
  3. ```

Legacy bundle

Standalone builds of graphology and its full standard library can be found in the repository's releases if you can only rely on your ownscript tags to load code.

  1. ``` html
  2. <script src="graphology.min.js"></script>
  3. <script>
  4.   const graph = new graphology.Graph();
  5.   const {UndirectedGraph, DirectedGraph} = graphology;
  6. </script>
  7. <script src="graphology-library.min.js"></script>
  8. <script>
  9.   const density = graphologyLibrary.metrics.graph.density(graph);
  10. </script>
  11. ```

Be warned that the standard library bundle often lags behind and is not always completely up to date.

TypeScript usage

Note that graphology also exports type declaration that are installed along using peer dependencies so it can be used with TypeScript out of the box.

If your version of npm is a bit old, you may need to install graphology-types yourself if the peer dependency resolution is not made for you already:

  1. ```
  2. npm install graphology-types
  3. ```

It can also be useful to pin graphology-types version in your package.json to avoid resolution issues sometimes.

How to cite


graphology is published on Zenodo as DOI

You can cite it thusly:

Guillaume Plique. (2021). Graphology, a robust and multipurpose Graph object for JavaScript. Zenodo. https://doi.org/10.5281/zenodo.5681257


Changelog


A complete changelog can be found here.