* Expected: 1. All nodes visited.
*/
public void test_4() {
int nnodes = 100;
GraphTestUtil.buildCircular(builder(), nnodes);
GraphVisitor visitor = new GraphVisitor() {
public int visit(Graphable component) {
if (component.getID() == 50) return(Graph.PASS_AND_CONTINUE);
return(Graph.FAIL_QUERY);
}
};
Node source = (Node)builder().getGraph().queryNodes(visitor).get(0);
CountingWalker walker = new CountingWalker();
NoBifurcationIterator iterator = createIterator();
iterator.setSource(source);
BasicGraphTraversal traversal = new BasicGraphTraversal(
builder().getGraph(), walker, iterator
);
traversal.init();
traversal.traverse();
//ensure all nodes visisited
visitor = new GraphVisitor() {
public int visit(Graphable component) {
assertTrue(component.isVisited());
return(0);
}
};