Configuration cloneConfig = configCheckDiffBetweenND.copy();cloneConfig.setLearnerCloneGraph(true);
AbstractLearnerGraph<List<CmpVertex>,LearnerGraphNDCachedData> copyOfA = grA.copy(cloneConfig), copyOfB = grB.copy(cloneConfig);
GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd = new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
gd.init(grA, grB, threadNumber,configCheckDiffBetweenND);gd.identifyKeyPairs();
//TestGD.printListOfPairs(gd.currentWave, gd.newBToOrig);
ChangesRecorder recorder = new ChangesRecorder(null);
gd.makeSteps();gd.computeDifference(recorder);
//Visualiser.updateFrame(gd.showGD(grA, grB, 1), null);
//Visualiser.updateFrame(grA, grB);
Assert.assertEquals(expectedSizeOfATOb,gd.aTOb.size());
Assert.assertEquals(expectedSizeOfDuplicates,gd.duplicates.size());
LearnerGraphND graph = new LearnerGraphND(cloneConfig);AbstractLearnerGraph.copyGraphs(grA, graph);
ChangesRecorder.applyGD(graph, recorder.writeGD(TestGD.createDoc()), converter);
Assert.assertNull(WMethod.checkM(grB, graph));
// Now do the same as above, but renumber states to match grB
AbstractLearnerGraph.copyGraphs(grA, graph);
Configuration configMut = conf.copy();configCheckDiffBetweenND.setLearnerCloneGraph(false);
LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData> graphPatcher = new LearnerGraphMutator<List<CmpVertex>,LearnerGraphNDCachedData>(graph,configMut,null);
ChangesRecorder.loadDiff(graphPatcher, recorder.writeGD(TestGD.createDoc()), converter);
graphPatcher.removeDanglingStates();
LearnerGraphND result = new LearnerGraphND(configMut);
graphPatcher.relabel(result);
Assert.assertNull(WMethod.checkM_and_colours(grB, result,VERTEX_COMPARISON_KIND.DEEP));