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
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() :
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
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?
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
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
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
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
8 matches
Mail list logo