purescript-graphs icon indicating copy to clipboard operation
purescript-graphs copied to clipboard

Partial constraint on topologicalSort

Open no-longer-on-githu-b opened this issue 9 years ago • 1 comments

If the graph contains cycles, then the behavior is undefined.

Should there be a Partial constraint?

An alternative is to make sure the function is total and then change the documentation to:

If the graph contains cycles, an unspecified value is returned.

no-longer-on-githu-b avatar Nov 14 '16 13:11 no-longer-on-githu-b

As I understand, the function is total, but if there are cycles in the input graph then the resulting list of keys is wrong, so the latter might be a better option.

vyorkin avatar Dec 31 '18 09:12 vyorkin