Reverse Breadth First traversal in C#

Posted by Ngu Soon Hui on Stack Overflow See other posts from Stack Overflow or by Ngu Soon Hui
Published on 2010-04-05T14:40:30Z Indexed on 2010/05/15 20:24 UTC
Read the original article Hit count: 243

Filed under:
|
|

Anyone has a ready implementation of the Reverse Breadth First traversal algorithm in C#?

By Reverse Breadth First traversal , I mean instead of searching a tree starting from a common node, I want to search the tree from the bottom and gradually converged to a common node.

Let's see the below figure, this is the output of a Breadth First traversal : alt text

In my reverse breadth first traversal , 9,10,11 and 12 will be the first few nodes found ( the order of them are not important as they are all first order). 5, 6, 7 and 8 are the second few nodes found, and so on. 1 would be the last node found.

Any ideas or pointers?

Edit: Change "Breadth First Search" to "Breadth First traversal" to clarify the question

© Stack Overflow or respective owner

Related posts about c#

Related posts about graph-algorithm