trailduck

a topological cyclic sorting algorithm based on depth-first search (dfs)

Usage no npm install needed!

<script type="module">
  import trailduck from 'https://cdn.skypack.dev/trailduck';
</script>

README

trailduck

GitHub stars

a topological cyclic sorting algorithm based on depth-first search (dfs)

Please ★ this repo if you found it useful ★ ★ ★

Features

  • works with cycles in the graph
  • detects overlapping cycles
  • loosly based on depth-first search (dfs)

Installation

npm install --save trailduck

Dependencies

Usage

const trailDuck = new TrailDuck({
  A: {
    children: ['B', 'D', 'E']
  },
  B: { children: ['C'] },
  C: { children: ['A'] },
  D: { children: ['E'] },
  E: { children: ['A'] }
});

console.log('cycles', trailDuck.cycles);
console.log('ordered', trailDuck.ordered);
console.log('tree', trailDuck.tree);

Support

Submit an issue

Screenshots

Contribute a screenshot

Contributing

Review the guidelines for contributing

License

MIT License

Jam Risser © 2018

Changelog

Review the changelog

Credits

Support on Liberapay

A ridiculous amount of coffee ☕ ☕ ☕ was consumed in the process of building this project.

Add some fuel if you'd like to keep me going!

Liberapay receiving Liberapay patrons