[jgrapht-users] Topological order traversal
Brought to you by:
barak_naveh,
perfecthash
From: Marden N. <mar...@uo...> - 2004-12-17 18:51:44
|
Hi, I found JGraphT while looking for a nice graph component framework which I could plug into the system I am developing. I need to implement a topological sort to execute a sequence of steps with inter-dependencies, forming a directed acyclic graph. I found JGraphT very useful for representing the graph and in a few minutes I could adapt the Graph class to an unit test of mine (using a dummy DAG and an even simpler adaptor). But I could not found a topological order traversal in JGraphT's distribution. Then I implemented one using the excellent infrastructure in the "traverse" package. There is still some serious unit testing to implement and lots of scenarios to validate, but I felt like submitting the code to JGraphT's community and get some feedback. One of the troubles I had when implementing the tests is that the topological sort of a DAG is not unique, so it is kind of hard to automate the tests. Other thing I could not understand clearly is how to defend the code agains cyclic graphs. The code for the TopologicalOrderIterator is attached. If one of the committers of the project finds it useful, I would be glad to discuss some strategies to implement some unit tests for it. My congratulations to Barak and the others for the good work. Best regards, Marden Neubert.=0A =0A___________________________________________________= _______________________=0AAcabe com aquelas janelinhas que pulam na sua t= ela.=0AAntiPop-up UOL - =C9 gr=E1tis!=0Ahttp://antipopup.uol.com.br/=0A |