# What is the algorithm used by ESRI for finding loops in a geometric network?

I've been trying to develop some code for ArcMap (VB .net) that would take a river network, identify and label the loops. These loops can be simple bifurcations or highly thread braided channels.

I was tinkering around with a sample of the NHD from the USA which is supplied as a geometric network. I tried the find loops Trace Task and was blown away by the fact that A) it did what I wanted and B) it is incredibly fast (less than a couple of seconds for a huge network).

Below is a screen shot of a bit of a network for Alaska with the polylines highlighted in red indicating they are part of a loop.

So I started looking on the internet to see if the algorithm is documented anywhere and I have failed to find anything.

I'm not a mathetician but I got the impression that I was looking at some sort of algorithm that detects "strongly connected components in an acyclic directed graph". I have found many references to a Tarjans algorithm. I found this blog page which was the easiest attempt to explain these sorts of algorithms but as always they show a very simple graph which is not a realistic scenario when considering river networks. As the screen shot above shows you have loops within loops. I could not work out or even determine if it would work in a multi-threaded network.

So my question is what algorithm is ESRI using? What algorithm would find all the loops in a multi-threaded river network? I would like to try and implement it outside a geometric network as not everyone has an ArcInfo (Advanced) license and able to create a geometric network.

If anyone knows of a site\paper than describes such an algorithm in a simple manner that would be great!