public DependencyGraph findLongestCallChain() {
    int depth = 0;
    DependencyGraph deepest = null;

    for (Object dep : vertices.keySet()) {
      int itsDepth = getDepth(dep);
      if (itsDepth > depth) {
        deepest = getSubGraph(dep);
        depth = itsDepth;
      }
    }

    return deepest;
  }
This will find the longest call chain in the graph. If a cycle is detected it will be returned.
Otherwise all subgraphs are traversed to find the one that has the most depth. This usually
indicates the thread that is blocking the most other threads.
<p>

The findDependenciesWith method can then be used to find all top-level threads that are blocked
by the culprit.
geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/DependencyGraph.java