I work in an obscure language with poor dependency management. To help get 14,000 file codes, I wrote several parsing tools (in Java) and created a dependency graph.
I wrote my own schedule and BFS classes and they work fine. With them, I have methods like getParents() and getChildren() .
Now I am trying to find the "islands" in this graph; that is, I'm trying to find which sections of our code base are independent of each other, hoping to assemble them into isolated modules.
Later I also plan to analyze individual islands to see if there are any weaknesses where we can install a modular barrier and define this module interface, but this is on the way.
Now I think about it:
Map<DependencyEntry, Set<DependencyEntry>> allChildren = new ...; for(DependencyEntry entry : allFiles) allChildren.put(entry,getAllChildren(entry)); Set<DependencyEntry> visited = new ...; Set<DependencyEntry> largest = new HashSet<DependencyEntry>();
That should give me the biggest island. From there, I can go through and exclude any sets that contain any visited nodes, and then run it again to get the next largest island, etc.
Is this an accurate algorithm? Is there a better way to solve this problem that I do not see?
source share