I'm working on some code for JavaScript dependency management and I'm figuring someone has tackled the dependency graph problem in Java already.
My first attempt was to just implement comparable on my JSResource object, but it falls over when there are multiple leaf nodes with no dependency and hence no sensible order unless influenced by their dependents.
So I figure I need a graph and then a way to iterate through the graph. Not an impossible problem but I thought I'd post here before reinventing the wheel.
Cheers, Pete
I posted something that might answer to your question. Here is the link: http://nicolaecaralicea.blogspot.com/2010/11/dependency-graphs-generic-approach-in.html
Here is the code:
There is a discussion about java graph handling libraries. Maybe it will help you.
Good Java graph algorithm library?
Many a times representing tasks as dependency graph is not sufficient, you would want to execute the tasks (represented as nodes) in parallel meeting the dependency conditions, plus do some house keeping works such as check for cycle etc.. For that purpose you can take help of this framework, which is a very light weight framework to run dependent tasks in a reliable way. Here is a test case to give you a brief idea:
Here is the console output to give you an idea of what is going under the hood