{
LearnerGraphND graph = new LearnerGraphND(buildGraph("A-a->B-a-#C\nA-d-#D\nA-c->A\nA-a->S-a->S","testWriteAndLoad5"),Configuration.getDefaultConfiguration());
graph.findVertex("B").setDepth(5);graph.findVertex("D").setColour(JUConstants.AMBER);
graph.addToCompatibility(graph.findVertex("A"), graph.findVertex("B"),JUConstants.PAIRCOMPATIBILITY.INCOMPATIBLE);
ChangesRecorder patcher = new ChangesRecorder(null);
patcher.addTransition(graph.findVertex("B"), "c", graph.findVertex("B"));
patcher.removeTransition(graph.findVertex("A"), "a", graph.findVertex("B"));
patcher.removeFromCompatibility(graph.findVertex("B"), graph.findVertex("A"));
patcher.addToCompatibility(graph.findVertex("B"), graph.findVertex("S"),JUConstants.PAIRCOMPATIBILITY.INCOMPATIBLE);
patcher.addTransition(graph.findVertex("A"), "q", graph.findVertex("B"));
patcher.setInitial(graph.findVertex("A"));
patcher.addRelabelling(VertexID.parseID("A"), VertexID.parseID("U"));
patcher.addRelabelling(VertexID.parseID("C"), VertexID.parseID("R"));
CmpVertex danglingVertex = AbstractLearnerGraph.generateNewCmpVertex(VertexID.parseID("TEST"), cloneConfig);
danglingVertex.setColour(JUConstants.BLUE);
patcher.addVertex(danglingVertex);
Configuration config = Configuration.getDefaultConfiguration().copy();config.setLearnerCloneGraph(false);
LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData> graphPatcher = new LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData>(graph,config,null);
ChangesRecorder.loadDiff(graphPatcher, patcher.writeGD(createDoc()));
graphPatcher.removeDanglingStates();
LearnerGraphND result = new LearnerGraphND(Configuration.getDefaultConfiguration());
graphPatcher.relabel(result);
LearnerGraphND expected = new LearnerGraphND(buildGraph("U-q->B-a-#R\nU-d-#D\nU-c->U\nB-c->B\nU-a->S-a->S","testWriteAndLoad1"),Configuration.getDefaultConfiguration());