mirror of
https://github.com/github/semantic.git
synced 2024-12-24 07:25:44 +03:00
Test a diamond graph.
Co-Authored-By: Rick Winfrey <rick.winfrey@gmail.com>
This commit is contained in:
parent
d346a36559
commit
4943a58d43
@ -44,6 +44,9 @@ simplify (Graph graph) = Graph (G.simplify graph)
|
||||
--
|
||||
-- >>> topologicalSort ((vertex 'a' `connect` vertex 'b') <> (vertex 'a' `connect` vertex 'c'))
|
||||
-- "cba"
|
||||
--
|
||||
-- >>> topologicalSort (Class.path "abd" <> Class.path "acd")
|
||||
-- "dcba"
|
||||
topologicalSort :: forall v . Ord v => Graph v -> [v]
|
||||
topologicalSort = go . toAdjacencyMap . G.transpose . unGraph
|
||||
where go :: A.AdjacencyMap v -> [v]
|
||||
|
Loading…
Reference in New Issue
Block a user