private boolean visitCycle(Object start, Set<Object> unvisited, Set<Object> finished,
      CycleHolder cycle, int depth) {
    if (finished.contains(start)) {
      return false;
    }

    if (!unvisited.remove(start)) {
      return true;
    }

    cycle.processDepth(depth);

    boolean foundCycle = false;
    for (Dependency dep : vertices.get(start)) {
      foundCycle |= visitCycle(dep.getDependsOn(), unvisited, finished, cycle, depth + 1);
      if (foundCycle) {
        cycle.add(dep);
        break;
      }
    }
    finished.add(start);

    return foundCycle;
  }
Visit a vertex for the purposes of finding a cycle in the graph.

@param start the node
@param unvisited the set of vertices that have not yet been visited
@param finished the set of vertices that have been completely analyzed
@param cycle an object used to record the any cycles that are detected
@param depth the depth of the recursion chain up to this point
geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/DependencyGraph.java