Re: [osg-users] Breadth-first-search

2009-10-23 Thread Jason Daly
Art Tevs wrote: In deed, current osg implementation uses recursion to traverse over the graph. Which is very suitable for DFS. Implementing BFS with recursion is not that easy, then DFS. The way, how I can solve that problem would be to write a method which just iteratively collects nodes in a

Re: [osg-users] Breadth-first-search

2009-10-23 Thread Himar Carmona
Hi, i agree with both of you. Queue seems to be necessary. I coded a BFS node visitor in response to this thread. Here is the code: class BFSNodeVisitor: public osg::NodeVisitor { public: std::queueosg::ref_ptrosg::Node _pendingNodesToVisit; BFSNodeVisitor() :

Re: [osg-users] Breadth-first-search

2009-10-23 Thread Art Tevs
Hi Himar, actually I realized that I do not need an exact case of BFS or DFS. In my case I need some kind of mixture processing. Thus every group node has to be processed until after every of its parents has been processed. So in my case I found a solution by using standard osg's DFS traverser

Re: [osg-users] Breadth-first-search

2009-10-21 Thread Art Tevs
Hi Paul, yes, thanks, it seems this is the way to go. cheers, art Paul Martz wrote: Hi Art -- Art Tevs wrote: However, currently any node visitor is going in depth-first-search (DFS) manner. Does anybody has already tried to implement breadth-first-search (BFS) in osg?

Re: [osg-users] Breadth-first-search

2009-10-21 Thread Art Tevs
Hi Paul, ok, I think I have to reject my previous post and will have to say that BFS with osg is not that easy as it sounds first. The problem is, that whenever I do iterate over the child list and let accept() a child the node visitor, I will end up in DFS. Because accept() means to call

Re: [osg-users] Breadth-first-search

2009-10-21 Thread Paul Martz
I guess my point was that traversal control is up to you. Paul Martz Skew Matrix Software LLC _http://www.skew-matrix.com_ http://www.skew-matrix.com/ +1 303 859 9466 Art Tevs wrote: Hi Paul, ok, I think I have to reject my previous post and will have to say that BFS with osg is not that

[osg-users] Breadth-first-search

2009-10-20 Thread Art Tevs
Hi folks, current svn/trunk version has this nice option for rendering the nodes in the same order as they are traversed by a nodevisitor. This is very nice feature, which makes my life almost simpler. However, currently any node visitor is going in depth-first-search (DFS) manner. Does

Re: [osg-users] Breadth-first-search

2009-10-20 Thread Paul Martz
Hi Art -- Art Tevs wrote: However, currently any node visitor is going in depth-first-search (DFS) manner. Does anybody has already tried to implement breadth-first-search (BFS) in osg? Rather than calling NodeVisitor::traverse() from your overridden apply() methods, iterate over the child