Brute force loop detector in graphs.