code: public static <T> void checkAreDescendentsOf(Set<T> inputSet, T root, Deps<T> deps) {
          // Check that all modules in the input set are descendents of the output module.
          HashSet<T> visited = new HashSet<T>();
          dfs(root, visited, deps);
          if (!visited.containsAll(inputSet)) {
              throw new IllegalStateException("Input set contains modules which are not descendents of the output module: " + inputSet);
          }
      }
docs: Checks that the given inputSet consists of only descendents of the root.