SYNOPSIS
This is a generic directional graph implementation. It makes use of ES6 iterators for graph traversal.
USAGE
const Digraph = // to start with the graph is just a single vertexvar vertex = // now lets add an edge named 'friend' to the vertex with the value 'alice'vertex vertex// now the graph looks like:// [vertex]---friend--->[alice]---brother-->[bob] //path names and vertex values can be anythingvertex // edges are stored in a Mapvertexedges // Map{} // to get an array of all of the verticesvar vertices = ...vertex // you can also iterate a pathvertices = ...vertex // getting a vertex works like settingvar friendsBotherVertex = vertexfriendsBotherVertex // "bob" // delete an edgevertex// now the vertex is emptyvertex
More Examples
./examples/
API
iterate
Notes onwhen decsending the graph, accumulate
!
when asecending the graph, aggergate
!
do you wish to not decsend futher?
then using continue
, do consider
accumlate
, continue
, aggergate
, repeat
accumlate
, continue
, aggergate
, repeat
EXTENDING
This was module was built so that it could be easly extended.