I'm analyzing some code for its dependencies. Let's say there are some interwoven dependencies, like so:
F
A /|
| / |
| / |
V < V
B<--->C--->E
\ / |
> < |
D<------+
B depends on A and C C depends on B and F E depends on C and F D depends on B and C and E
We have a problem with B and C, they depend on each other. They should be combined into a super-node. We have a problem with C and E and F, they have a cycle. They should be combined into a super-node.
You would end up with
A
|
V
super
node
|
|
D
Is there a good library or algorithm source (Java prefered, but open to suggestions) that allows for such reduction?
Any nodes in a cycle are combined into a single node. Any node that pointed to any node in the new node should point to the new node. Any node pointed to by any node in the new node should cause the new node to point to that node.
Thanks!