return(GraphTraversal.CONTINUE);
}
};
BreadthFirstIterator iterator = createIterator();
BasicGraphTraversal traversal = new BasicGraphTraversal(
builder().getGraph(), walker, iterator
);
traversal.init();
iterator.setSource(root);
traversal.traverse();
//ensure that subnodes of first visited after root are not visited
final String id = (ln.getCount() < rn.getCount()) ?
ln.getObject().toString() :
rn.getObject().toString();
GraphVisitor visitor = new GraphVisitor() {
public int visit(Graphable component) {
String eid = component.getObject().toString();
if (eid.length() <= id.length()) assertTrue(component.isVisited());
else if (eid.startsWith(id)) assertTrue(!component.isVisited());
else assertTrue(component.isVisited());
return(0);
}
};
builder().getGraph().visitNodes(visitor);
//ensure that nodes only visited once
assertTrue(walker.getCount() == (int)Math.pow(2,k)+1);
traversal.traverse();
builder().getGraph().visitNodes(visitor);
//ensure that nodes only visited once
assertTrue(walker.getCount() == (int)Math.pow(2,k)+1);