Skip to content

boltpkg/grouped-topo-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grouped-topo-sort

This package sorts a graph of grouped dependencies into an optimised order for installation / build / etc.

It also reports on cycles in the dependency graph when they cannot be resolved by the groups.

Usage:

const sort = require('grouped-topo-sort');

// these are the dependencies to sort
const graph = {
  a: ['b'],
  b: ['c'],
  c: ['d'],
  d: ['a'],
};

// we use groups to hint that 'a' can be safely resolved before 'b', 'c' and 'd'
// which lets us break the cycle and return a valid result
const groups = [['a'], ['b', 'c', 'd']];

const result = sort(graph, groups); // { sorted: ['a', 'd', 'c', 'b'] }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published