Looking for loops in networks.
It’s seems very simple, but when i’ve started to search for a programmatic way to solve this, you ends up with a kind of complexity that seems much too high compared to the problem.
After a bit of research, i found the Rocha Thatte method. It is a very elegant way to detect “cycles” in “directed graphs”. Description in wikipedia.
This is a js implementation, based on the java version, used to study the implementation.