//checks if u (and v) touches an intersection of the hypercube, and if so, //returns true if that point is in the vertex set private static bool CheckVertexSet(Point2 u, Point2 v, int[] gap0, int d, int k) { if (!Globals.CheckVStar) { return(true); } var index = ""; var found = false; for (int i = 0; i < Globals.d; i++) { //check that point is in intersection with hypercube if (v.Coordinates[i] != Globals.k && v.Coordinates[i] != 0) { continue; } index = d.ToString() + "," + k.ToString() + "," + (2 * Globals.gap - gap0[i]).ToString(); //check for existence of vertex set if (Globals.VertexSet.ContainsKey(index) && Globals.VertexSet[index].Count == 0) { continue; } Point2 q = v.DecreaseDimensionality(i); found = false; foreach (Point2 p in Globals.VertexSet[index]) { if (p.Equals(q)) { found = true; break; } } if (!found) { return(false); } } for (int i = 0; i < Globals.d; i++) { //check that point is in intersection with hypercube if (u.Coordinates[i] != Globals.k && u.Coordinates[i] != 0) { continue; } index = d.ToString() + k.ToString() + gap0[i].ToString(); //check for existence of vertex set if (Globals.VertexSet.ContainsKey(index) && Globals.VertexSet[index].Count == 0) { continue; } Point2 q = u.DecreaseDimensionality(i); found = false; foreach (Point2 p in Globals.VertexSet[index]) { if (p.Equals(q)) { found = true; break; } } if (!found) { return(false); } } return(true); }