ngraph.traverse
I'm trying to come up with easy way to traverse graphs, this is all very experimental.
Usage
var traverseNodes = nodes;// Let's say `graph' is a graph. How to traverse all nodes?;// How all adjacent nodes of `startNodeId'?var children =;
Traversal does not start until you call forEach()
method. This allows you to delay computation.
You can also compose results of previous traversal. E.g. How to visit all neighbors of children from example above?
// All grandchildren?;
To traverse links:
var traverseLinks = links;// all links in graph:;// All outgoing links from node:;// All incoming links:;// If your links has properties on them:graph;// You can traverse only those links:;// This is equivalent to:;
You can traverse from to sets too:
// Traverse all links from nodes with ids 1, 2, 3:;// You can use traversers too:var children = ;// get all links to children:links;// get all links to grandchildren:var grandChildren = ;links;
License
BSD 3-Clause