Skip to content
forked from liy/topo-sort

Simple and fast implementation of topological sorting. No dependencies. A circular graph will throw an error with circular nodes info.

License

Notifications You must be signed in to change notification settings

insysbio/topo-sort

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is fork from https://github.com/liy/topo-sort for more informative error object.

Error update

When the graph is cyclic than the Error object has property "circular" with the Array of circular ids.

Usage

Must not add any null, undefined or empty string node.

var TopoSort = require('topo-sort');

var tsort = new TopoSort();
tsort.add('a', ['b', 'c']);
tsort.add('d', ['a', 'b', 'c']);
// Output d,a,c,b
var l = tsort.sort();

About

Simple and fast implementation of topological sorting. No dependencies. A circular graph will throw an error with circular nodes info.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%