private boolean isLinked(String src, String dst, Set<ConsumerPair> pairs, List<String> currentPath) {
            if (src.equals(dst))
                return false;

            if (pairs.isEmpty())
                return false;

            if (new ConsumerPair(src, dst).in(pairs)) {
                currentPath.add(src);
                currentPath.add(dst);
                return true;
            }

            for (ConsumerPair pair: pairs)
                if (pair.srcMemberId.equals(src)) {
                    Set<ConsumerPair> reducedSet = new HashSet<>(pairs);
                    reducedSet.remove(pair);
                    currentPath.add(pair.srcMemberId);
                    return isLinked(pair.dstMemberId, dst, reducedSet, currentPath);
                }

            return false;
        }
This class maintains some data structures to simplify lookup of partition movements among consumers. At each point of
time during a partition rebalance it keeps track of partition movements corresponding to each topic, and also possible
movement (in form a <code>ConsumerPair</code> object) for each partition.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java