code: public Set<Integer> getAdjacentFactors(int factorNum) {
      Set<Integer> adjacentFactors = Sets.newHashSet();
      for (Integer variableNum : factorVariableMap.get(factorNum)) {
        adjacentFactors.addAll(variableFactorMap.get(variableNum));
      }
      return adjacentFactors;
    }
docs: Gets the indices of all factors which are adjacent (that is,
  share at least one variable) with {@code factorNum}.
  
  @param factorNum
  @return