I'm looking for a reputable Java implementation of a topological sort, given a directed graph of dependencies (node #7 depends on node #2, node #2 depends on note #4, etc.), that will detect the presence of a cycle so I can report an error if a cycle occurs.
I assume Apache ant
has to do this so I'm hoping I could just make use of it, but if not then I'm sure there's something else out there. Otherwise I suppose I could implement one of the algorithms in the Wikipedia page, but I am somewhat error prone so would rather not reinvent the wheel.
any suggestions?