[jgrapht-users] Accessing nodes while iterating on graph.
Brought to you by:
barak_naveh,
perfecthash
From: Serge Prud'h. <ser...@ya...> - 2008-04-15 21:52:23
|
Greetings, I recently discovered JGraphT and I have the following problem. I need to do a project management tool which means I have an acyclic directed graph holding the duration of each activity in each node and edges between nodes representing the dependencies between the actvities. example: TaskA duration=3 TaskB duration=4 TaskC duration=5 TaskD duration=6 TaskA --> TaskC TaskB --> TaskC TaskC --> TaskD I want to do a traversal of the graph and for each node update a "leadTime" member to each node indicating the minimum time for the availability of each task. The lead time can be expressed as follow: the maximum leadTime of all the direct ancestors + task duration. TaskA duration =3 leadTime=3 TaskB duration =4 leadTime=4 TaskC duration =5 leadTime=4 =max(3, 4) TaskD duration =5 leadTime=9 =max(3, 4) + 5 A TopologicalOrderIterator seems like a good fit but I cannot figure out how to access the information from the previous node while iterating. The TraversalListener seemed promissing but I don't see how to access the source and destination nodes from the EdgeTraversalEvent. Ideas? Thanks Serge between 0000-00-00 and 9999-99-99 |