assertTrue(built.getEdges().size() == n);
assertTrue(built.getNodes().size() == n+1);
GraphVisitor visitor = new GraphVisitor() {
public int visit(Graphable component) {
DirectedNode node = (DirectedNode)component;
Coordinate c = (Coordinate)node.getObject();
if (node.getDegree() == 1) {
assertTrue(
(node.getID()==0&&node.getInDegree()==0&&node.getOutDegree()==1)||
(node.getID()==n&&node.getInDegree()==1&&node.getOutDegree()==0)
);
}
else {
assertTrue(node.getInDegree() == 1 && node.getOutDegree() == 1);
}
assertTrue(
c.x == base.x + node.getID() && c.y == base.y + node.getID()
);
return(0);
}
};
built.visitNodes(visitor);