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.
Should there be a
Partialconstraint?An alternative is to make sure the function is total and then change the documentation to: