Package Exports
- graph-data-structure
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graph-data-structure) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
graph-data-structure
A graph data structure with topological sort algorithm.
Usage
Install the library by running
npm install graph-data-structure
Require it in your code like this.
var Graph = require("graph-data-structure");Create a graph.
var graph = Graph();Add some nodes and edges.
graph.addNode("a");
graph.addNode("b");
graph.addEdge("a", "b");Nodes are added implicitly when edges are added.
graph.addEdge("b", "c");Topological sort can be invoked with an array source nodes (which are excluded from the result).
graph.topologicalSort(["a"]); // Returns ["b", "c"]For more detailed example code, have a look at the tests.
