Graph<PsiPackage> () { return GraphGenerator.generate(CachingSemiGraph.cache(new InboundSemiGraph<>() { @Override @NotNull public Collection<PsiPackage> getNodes() { return getAllScopePackages().values(); } @NotNull @Override public 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(); } })); }