Topological Sort
Ordering a dependency graph so nothing is built before what it needs, demoing the p/moul/x/daily/toposort library.
The graph
avl <- strings
markdown <- strings
realm <- storage, ui
storage <- avl
strings
ui <- markdown
Install order
stringsavlmarkdownstorageuirealm
Ties are broken lexicographically, so this ordering is the only one the library will ever produce for this graph.
See
/cyclefor what happens when the graph is not a DAG.