elm-community / graph

Functional Graph Library in Elm.

Home Page:http://package.elm-lang.org/packages/elm-community/graph/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

heightLevels accepts graphs with cycles

DavidDTA opened this issue · comments

This is related to #4.

heightLevels is another function whose result doesn't make sense if the graph has cycles. I think the signature of heightLevels should be a result like topologicalSort.

Alright, I redesigned stuff around an AcyclicGraph abstraction that is returned by a new checkAcyclic function and also by stronglyConnectedComponents. This can be passed to topologicalSort and heightLevels, making them total.

Does this work for you? If so, I'll make a release to get this out.

That sounds like a good way of handling it to me.