0.2.2 • Published 3 years ago
@aureooms/js-topological-sorting v0.2.2
:oden: @aureooms/js-topological-sorting
Topological sorting algorithms for JavaScript. See docs.
:warning: The code requires
regeneratorRuntime
to be defined, for instance by importing regenerator-runtime/runtime.
// Sort anything that can be iterated over with `for (const [u, v] of ...)`
import {sorted} from '@aureooms/js-topological-sorting';
sorted(["ab", "bc"]); // abc
// Add a comparison function to break ties.
import {increasing} from '@aureooms/js-compare';
sorted(["ab", "cd"], increasing); // abcd
import {decreasing} from '@aureooms/js-compare';
sorted(["ab", "cd"], decreasing); // cdab