graph-toposort
> A modified implementation of [Kahn's Algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) > for [topologically sorting](https://en.wikipedia.org/wiki/Topological_sorting) a > [graph.js](https://github.com/mhelvens/graph.js) i
Last updated 5 years ago by dominicbarnes .
Original npm · Tarball · package.json
$ cnpm install graph-toposort 
SYNC missed versions from official npm registry.

node-graph-toposort

A modified implementation of Kahn's Algorithm for topologically sorting a graph.js instance.

npm version build status

Install

$ npm install graph-toposort

Example

var toposort = require('graph-toposort');
var Graph = require('graph.js');

// a -> b -> c
var graph = new Graph(
  [ 'a', 'b' ],
  [ 'b', 'c' ]
);

var list = toposort(graph);
// [ 'a', 'b', 'c' ]

Usage

This algorithm is useful when determining what order to go in when dealing with a tree of dependencies. While circular dependencies are being handled, it is still an experimental feature, so please report any problems you find with it.

toposort(graph)

Given the input graph, it will return an Array of the vertex keys sorted topologically.

Current Tags

  • 0.2.0                                ...           latest (5 years ago)

3 Versions

  • 0.2.0                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |