RequiresGraph (Project project) { MultiMap<PsiJavaModule, PsiJavaModule> relations = MultiMap.create(); Set<String> transitiveEdges = new HashSet<>(); JavaModuleNameIndex index = JavaModuleNameIndex.getInstance(); GlobalSearchScope scope = ProjectScope.getAllScope(project); for (String key : index.getAllKeys(project)) { for (PsiJavaModule module : index.getModules(key, project, scope)) { visit(module, relations, transitiveEdges); } } Graph<PsiJavaModule> graph = GraphGenerator.generate(new ChameleonGraph<>(relations, true)); return new RequiresGraph(graph, transitiveEdges); }