8000 GitHub - dominicbarnes/node-graph-toposort: A topological sorter for graph.js instances · GitHub
[go: up one dir, main page]

Skip to content

About

A topological sorter for graph.js instances

Resources

Stars

7 stars

Watchers

2 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

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.

About

A topological sorter for graph.js instances

Resources

Stars

7 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

0