topological
Topologically sort lists of any type.
gleam add topological@1
import topological
pub fn main() {
[#("A", ["B", "C"]), #("B", ["C"]), #("C", ["D"]), #("D", [])]
|> topological.sort
// Ok(["A", "B", "C", "D"])
}
Further documentation can be found at https://hexdocs.pm/topological.
Development
gleam run
gleam test