//ensure same number of nodes and edges
assertTrue(before.getNodes().size() == after.getNodes().size());
assertTrue(before.getEdges().size() == after.getEdges().size());
//ensure same graph structure
GraphVisitor visitor = new GraphVisitor() {
public int visit(Graphable component) {
DirectedEdge e = (DirectedEdge)component;
assertTrue(e.getInNode().getID() == e.getID());
assertTrue(e.getOutNode().getID() == e.getID()+1);
return(0);
}
};
after.visitEdges(visitor);
visitor = new GraphVisitor() {
public int visit(Graphable component) {
DirectedNode n = (DirectedNode)component;
if (n.getDegree() == 1) {
assertTrue(n.getID() == 0 || n.getID() == nnodes-1);