public void TestMakeMove() { VfState vfs = VfsTest(); vfs.MakeMove(1, 0, Groups.FromMapping); Assert.AreEqual(1, vfs._lstOut1.Count); Assert.AreEqual(5, vfs._lstDisconnected1.Count); Assert.AreEqual(Groups.FromMapping, vfs.Vfgr1.GetGroup(0)); }
internal void Backtrack(VfState vfs) { switch (_act) { case Action.deleteMatch: vfs.RemoveFromMappingList(_iGraph, _inod); break; case Action.groupMove: vfs.MakeMove(_iGraph, _inod, _grpRestore); break; } }
internal void Backtrack <TVAttr, TEAttr>(VfState <TVAttr, TEAttr> vfs) { switch (_act) { case Action.DeleteMatch: // Undo a matching vfs.RemoveFromMappingList(_iGraph, _ivtx); break; case Action.GroupMove: // Move back to previous group vfs.MakeMove(_iGraph, _ivtx, _grpRestore); break; } }
internal void MoveToGroup(int iGraph, int inod, Groups grpNew, VfState vfs) { VfGraph vfg = iGraph == 1 ? vfs.Vfgr1 : vfs.Vfgr2; Groups grpOld = vfg.GetGroup(inod); if (grpOld == Groups.FromMapping && grpNew == Groups.ToMapping || grpOld == Groups.ToMapping && grpNew == Groups.FromMapping) { grpNew = Groups.FromMapping | Groups.ToMapping; } if (grpOld != (grpOld | grpNew)) { AddAction(new BacktrackAction(Action.groupMove, iGraph, inod, grpOld)); vfs.MakeMove(iGraph, inod, grpNew); } }
/// <summary> /// Move vertex to one of the four classifications: /// + unconnected to any vertex in isomorphism /// + points in to vertex in isomorphism /// + pointed to be a vertex in isomorphism /// + in the isomorphism /// Note that this call may be redundant - i.e., we may "move" a vertex /// to a group it's already in. That's expected and we don't actually do /// anything in that case. /// </summary> /// <param name="iGraph">Graph to take action on</param> /// <param name="ivtx">Vertex index of vertex to act on</param> /// <param name="grpNew">New group to potentially move vertex to</param> /// <param name="vfs">State determining the isomorphism</param> internal void MoveToGroup(int iGraph, int ivtx, Group grpNew, VfState <TVAttr, TEAttr> vfs) { var vfg = iGraph == 1 ? vfs.VfGraph1 : vfs.VfGraph2; var grpOld = vfg.GetGroup(ivtx); // If vertex is newly connected to the isomorphism, see if it was connected // in the opposite direction previously - if so, it's now connected both ways. if (grpOld == Group.FromMapping && grpNew == Group.ToMapping || grpOld == Group.ToMapping && grpNew == Group.FromMapping) { grpNew = Group.FromMapping | Group.ToMapping; } // If we actually made a change, then add it to the action list and ensure that // it's recorded in the graph. if (grpOld != (grpOld | grpNew)) { AddAction(new BacktrackAction(Action.GroupMove, iGraph, ivtx, grpOld)); vfs.MakeMove(iGraph, ivtx, grpNew); } }