//----< 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); }
//----< depth first search from specific node >------------------------ public void walk(CsNode <V, E> node) { gop.doNodeOp(node); node.visited = true; do { CsEdge <V, E> childEdge = node.getNextUnmarkedChild(); if (childEdge == null) { return; } else { gop.doEdgeOp(childEdge.edgeValue); walk(childEdge.targetNode); if (node.hasUnmarkedChild() || showBackTrack) { gop.doNodeOp(node); } } } while (true); }