[jgrapht-users] DepthFirstIterator - Skip and move to next branch?
Brought to you by:
barak_naveh,
perfecthash
From: Michael Z. <li...@in...> - 2008-03-03 12:17:57
|
Hi there! for a project I use jgrapht as library to store information about parent-child relationships. Thanks a lot for this great library! One issue I could not solve myself is related to DepthFirstIteration. Assume the following graph: A->B->C-D->E A->X->Y->Z I want to iterate over all items in my graph depth first. If a certain condition is true, the rest of the current branch should be skipped and the iterator should continue with the next branch. In my example, the iterator would go as follows: 1) A->X->Y (condition fulfilled; skip Z) 2) B->C->D->E Is there an easy way how to solve this? Any option like: DepthFirstIterator it = new ... while (it.hasNext()) { MyObject o = it.next(); if (o.condition == true) it.nextBranch() thanks and cu, Michael |