private List <int> GetList(List <int> lstOfNodes, VfGraph vfgr, Groups grp) { List <int> lstRet = new List <int>(); foreach (int inod in lstOfNodes) { if (((int)vfgr.GetGroup(inod) & (int)grp) != 0) { lstRet.Add(inod); } } return(lstRet); }
private int GetGroupCountInList(IEnumerable <int> lstOfNodes, VfGraph vfgr, Groups grp) { int cnod = 0; foreach (int inod in lstOfNodes) { if (((int)vfgr.GetGroup(inod) & (int)grp) != 0) { cnod++; } } return(cnod); }
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> /// Count vertices in a list which are in a particular classification /// </summary> /// <param name="lstOfVertexIndices">List of vertex indices to check</param> /// <param name="vfgr">Graph which contains the vertex</param> /// <param name="grp">Classification to check for</param> /// <returns>Count of vertices in list which are classified properly</returns> private int GetGroupCountInList(IEnumerable <int> lstOfVertexIndices, VfGraph <TV, TE> vfgr, Group grp) { return(lstOfVertexIndices.Count(ivtx => ((int)vfgr.GetGroup(ivtx) & (int)grp) != 0)); }