topograph
Stores a graph of nodes and provides topological sorting. Basically just an OO API for toposort so you can build your graph incrementally.
Installation
$ packin add jkroso/graph
then in your app:
var graph =
API
Graph()
Graph class
Graph.addNode(node)
add node
if not already in the graph
Graph.addEdge(from, to)
add two nodes with a relationship
Graph.addRelationship(from, to)
add a relationship between two existing nodes
Graph.toArray()
convert to a topologically sorted array
Graph.clone()
clone this Graph
Example
'c' 'a' 'd' 'b' // => ['a', 'b', 'c', 'd']
Running the tests
Just run make
and navigate your browser to the test directory.