ring detection
now work on jgrapht 0.9.0