static void Merge(Vertex a, Vertex b, int nameA, int nameB) { name[b] = nameA; var c = next[b]; while (name[c] != nameA) { name[c] = nameA; c = next[c]; } size[nameA] += size[nameB]; c = next[a]; next[a] = next[b]; next[b] = c; }
public static int SizeOf(Vertex a, Vertex b) => Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y);
public Edge(Vertex a, Vertex b) { A = a; B = b; }