// (input).
// We populate (or remove elements from) the input and check the output
// to see
// if it is a copy of the input.
Graph output = new MultiGraph("outout");
input.addSink(output);
Node A = input.addNode("A");
input.addNode("B");
input.addNode("C");
input.addEdge("AB", "A", "B");
Edge BC = input.addEdge("BC", "B", "C");
input.addEdge("CA", "C", "A");
A.addAttribute("foo", "bar");
BC.addAttribute("foo", "bar");
assertEquals(3, input.getNodeCount());
assertEquals(3, output.getNodeCount());
assertEquals(3, input.getEdgeCount());
assertEquals(3, output.getEdgeCount());
assertNotNull(output.getNode("A"));
assertNotNull(output.getNode("B"));
assertNotNull(output.getNode("C"));
assertNotNull(output.getEdge("AB"));
assertNotNull(output.getEdge("BC"));
assertNotNull(output.getEdge("CA"));
assertEquals("bar", output.getNode("A").getAttribute("foo"));
assertEquals("bar", output.getEdge("BC").getAttribute("foo"));
// Now remove an attribute.
A.removeAttribute("foo");
assertFalse(output.hasAttribute("foo"));
// Now remove a node.
input.removeNode("A");
assertEquals(2, input.getNodeCount());
assertEquals(1, input.getEdgeCount());
assertEquals(2, output.getNodeCount());
assertEquals(1, output.getEdgeCount());
// Now check that attribute change works.
BC.changeAttribute("foo", "truc");
assertEquals("truc", BC.getAttribute("foo"));
assertEquals("truc", output.getEdge("BC").getAttribute("foo"));
}