Exemplo n.º 1
0
        //----< depth first search from specific node >------------------------

        public void walk(CsNode <V, E> node)
        {
            // process this node

            gop.doNodeOp(node);
            node.visited = true;

            // visit children
            do
            {
                CsEdge <V, E> childEdge = node.getNextUnmarkedChild();
                if (childEdge == null)
                {
                    return;
                }
                else
                {
                    gop.doEdgeOp(childEdge.edgeValue);
                    walk(childEdge.targetNode);
                    if (node.hasUnmarkedChild() || showBackTrack)
                    {                         // popped back to predecessor node
                        gop.doNodeOp(node);   // more edges to visit so announce
                    }                         // location and next edge
                }
            } while (true);
        }
Exemplo n.º 2
0
        public void Walk(CsNode <V, E> node)
        {
            graphOp.DoNodeOperation(node);
            node.visited = true;

            do
            {
                CsEdge <V, E> childEdge = node.GetNextUnmarkedChild();
                if (childEdge == null)
                {
                    return;
                }
                else
                {
                    graphOp.DoEdgeOperation(childEdge.edgeValue);
                    Walk(childEdge.targetNode);
                    if (node.HasUnmarkedChild() || showBackTrack)
                    {
                        graphOp.DoNodeOperation(node);
                    }
                }
            } while (true);
        }