public static Set<VarVersionNode> rootReachability(Set<VarVersionNode> roots) {
    Set<VarVersionNode> visited = new HashSet<>();

    ListStack<VarVersionNode> stack = new ListStack<>(roots);

    while (!stack.isEmpty()) {
      VarVersionNode node = stack.pop();

      if (visited.add(node)) {
        stack.addAll(node.successors);
      }
    }

    return visited;
  }
Returns the set of nodes that are reachable by the given roots.
src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java