Skip to content

graph-algorithm/topological-sorting

Folders and files

NameName
Last commit message
Last commit date
Feb 20, 2025
Mar 9, 2021
Jul 27, 2021
Feb 12, 2024
Feb 12, 2024
Mar 25, 2021
Jul 27, 2021
Jul 27, 2021
Feb 12, 2024
Mar 9, 2021
Mar 9, 2021
Feb 12, 2024
May 9, 2025
Apr 26, 2021
Mar 9, 2021
May 9, 2025

Repository files navigation

Topological sorting algorithms for JavaScript. See docs.

⚠️ 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 '@graph-algorithm/topological-sorting';
sorted(["ab", "bc"]); // abc

// Add a comparison function to break ties.
import {increasing} from '@total-order/primitive';
sorted(["ab", "cd"], increasing); // abcd

import {decreasing} from '@total-order/primitive';
sorted(["ab", "cd"], decreasing); // cdab

License Version Tests Dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size