public boolean areVarsAnalogous(int varBase, int varCheck) {
    Deque<VarVersionNode> stack = new ArrayDeque<>();
    Set<VarVersionNode> visited = new HashSet<>();

    VarVersionNode start = this.nodes.getWithKey(new VarVersionPair(varBase, 1));
    stack.add(start);

    while (!stack.isEmpty()) {
      VarVersionNode node = stack.removeFirst();
      ValidationHelper.validateTrue(
        node.phantomParentNode == null && node.phantomNode == null,
        "`areVarsAnalogous` should not be called after ppmm or operator assignments resugaring");

      if (visited.contains(node)) {
        continue;
      }

      visited.add(node);
      VarVersionNode analog = this.nodes.getWithKey(new VarVersionPair(varCheck, node.version));

      if (analog == null) {
        return false;
      }

      if (node.successors.size() != analog.successors.size()) {
        return false;
      }

      // FIXME: better checking
      for (VarVersionNode dest : node.successors) {
        stack.add(dest);

        VarVersionNode sucAnalog = this.nodes.getWithKey(new VarVersionPair(varCheck, dest.version));

        if (sucAnalog == null) {
          return false;
        }
      }
    }

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