Now there is a library: graphlib
Graphlib is a JavaScript library that provides data structures for undirected and directed multi-graphs along with algorithms that can be used with them.
Implements:
- directed and undirected graphs (does A -> B imply B -> A)
- multigraphs (multiple distinct named edges from A -> B)
- compound graphs (nodes can have children that form a "subgraph")
- Dijkstra algorithm (shortest path)
- Floyd-Warshall algorithm (shortest path supporting negative weights)
- Prim's algorithm (minimum spanning tree)
- Tarjan's algorithm (strongly connected components)
- Topological sorting (dependency sort for directed acyclic graphs)
- Pre- and postorder traversal (callback on every node)
- Finding all cycles and testing if a graph is acyclic
- Finding all connected components
NPM, Bower and browser supported, MIT license.