private Graph<PsiPackage> buildGraph() {
    return GraphGenerator.generate(CachingSemiGraph.cache(new InboundSemiGraph<>() {
      @Override
      public @NotNull Collection<PsiPackage> getNodes() {
        return getAllScopePackages().values();
      }

      @Override
      public @NotNull Iterator<PsiPackage> getIn(PsiPackage psiPack) {
        final Set<PsiPackage> psiPackages = myPackageDependencies.get(psiPack);
        if (psiPackages == null) {     //for packs without java classes
          return Collections.emptyIterator();
        }
        return psiPackages.iterator();
      }
    }));
  }
private Graph<PsiPackage> buildGraph()