elm-community/graph

heightLevels accepts graphs with cycles

DavidDTA opened this issue · 2 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.