(topological-sort g)Efficiently sorts a directed acyclic graph using Kahn's algorithm with in-degree counting. 'g' is a map of nodes to sequences of their dependencies. Returns a map with :sorted containing the topologically sorted list of nodes, and :cyclic containing the remaining nodes if a cycle is detected.
Efficiently sorts a directed acyclic graph using Kahn's algorithm with in-degree counting. 'g' is a map of nodes to sequences of their dependencies. Returns a map with :sorted containing the topologically sorted list of nodes, and :cyclic containing the remaining nodes if a cycle is detected.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |