Note that I\'ve already gone through How to detect a loop in a hierarchy of javascript elements In our case, we\'re not dealing with a linked-list, but a hierarchical graph wher