This is not a cycle, but in context it is a problem.

Here is a diagram:

The red arrow creates an illegal path because it would bypass A.

This can happen anywhere in a graph, so I need a general way of detecting them. I would only need to detect the first one, and error in such case.

Does this type of configuration have a name? Or associated algorithm of detection?

Please do not provide deep solutions, because it's an assignment. I am pretty stumped though.

Thank you.

EDIT:

I think I might need this: https://en.wikipedia...logical_sorting

Does that seem reasonable?

EDIT:

OK. It seems like if I use Kahn's algorithm to construct a topological sort of start nodes, and the resultant set matches my set of all nodes in graph, then there is no violation of dependencies in the graph, otherwise there is.

Does this seem correct to you?

This post has been edited by **MentalFloss**: 07 October 2018 - 06:46 PM