// Is the poset P_n of isomorphism classes of n-vertex graphs, ordered by "is a subgraph of", // free of nontrivial automorphisms? Method: enumerate all classes (canonical forms), build the // Hasse diagram (H covers G iff G = H - e), then run colour refinement starting from the rank // (edge count) and refining by the multisets of colours of lower and upper covers. Every poset // automorphism preserves the stable colouring, so a discrete stable colouring proves Aut(P_n) = 1. const n = +process.argv[2] || 6; const E = []; const eid = []; for (let i = 0; i < n; i++) eid.push(Array(n).fill(-1)); for (let i = 0; i < n; i++) for (let j = i + 1; j < n; j++) { eid[i][j] = eid[j][i] = E.length; E.push([i, j]); } const m = E.length; if (m > 30) throw "n too large for 32-bit masks"; function adj(g) { const A = Array.from({ length: n }, () => []); for (let k = 0; k < m; k++) if (g >>> k & 1) { const [i, j] = E[k]; A[i].push(j); A[j].push(i); } return A; } function permsOf(arr) { if (arr.length <= 1) return [arr.slice()]; const r = []; arr.forEach((x, i) => { for (const p of permsOf([...arr.slice(0, i), ...arr.slice(i + 1)])) r.push([x, ...p]); }); return r; } function canon(g) { const A = adj(g); const deg = A.map(a => a.length); const inv = A.map((a, v) => deg[v] * 1000 + 0) .map((x, v) => [x, A[v].map(u => deg[u]).sort((p, q) => p - q).join(".")]); const keys = [...new Set(inv.map(x => x[0] + "|" + x[1]))].sort(); const cells = keys.map(k => inv.map((x, v) => [x[0] + "|" + x[1], v]).filter(y => y[0] === k).map(y => y[1])); const cellPerms = cells.map(c => permsOf(c)); let best = -1; const order = []; (function rec(ci) { if (ci === cells.length) { // order[pos] = vertex; label vertex -> pos const lab = Array(n); order.forEach((v, pos) => lab[v] = pos); let h = 0; for (let k = 0; k < m; k++) if (g >>> k & 1) { const [i, j] = E[k]; h |= 1 << eid[lab[i]][lab[j]]; } h >>>= 0; if (best < 0 || h < best) best = h; return; } for (const p of cellPerms[ci]) { const L = order.length; order.push(...p); rec(ci + 1); order.length = L; } })(0); return best; } // enumerate by rank const levels = [[canon(0)]]; const index = new Map([[levels[0][0], 0]]); const all = [levels[0][0]]; const rank = [0]; const down = [[]]; const up = [[]]; for (let r = 1; r <= m; r++) { const next = []; for (const g of levels[r - 1]) for (let k = 0; k < m; k++) if (!(g >>> k & 1)) { const h = canon((g | (1 << k)) >>> 0); if (!index.has(h)) { index.set(h, all.length); all.push(h); rank.push(r); down.push([]); up.push([]); next.push(h); } } levels.push(next); } // covers for (let x = 0; x < all.length; x++) { const g = all[x]; const s = new Set(); for (let k = 0; k < m; k++) if (g >>> k & 1) s.add(index.get(canon((g & ~(1 << k)) >>> 0))); for (const y of s) { down[x].push(y); up[y].push(x); } } // set-edge-deck collisions (graphs with same rank and same set of edge-deleted classes) const deckKey = new Map(); let collisions = 0; for (let x = 0; x < all.length; x++) { const key = rank[x] + ":" + down[x].slice().sort((a, b) => a - b).join(","); if (deckKey.has(key)) collisions++; else deckKey.set(key, x); } // colour refinement let col = rank.slice(); let ncol = new Set(col).size; for (let it = 0; ; it++) { const sig = col.map((c, x) => c + "/" + down[x].map(y => col[y]).sort((a, b) => a - b).join(",") + "/" + up[x].map(y => col[y]).sort((a, b) => a - b).join(",")); const ids = new Map(); const nc = sig.map(s => { if (!ids.has(s)) ids.set(s, ids.size); return ids.get(s); }); const k = ids.size; col = nc; if (k === ncol) break; ncol = k; } const sizes = {}; for (const c of col) sizes[c] = (sizes[c] || 0) + 1; const nonSingleton = Object.values(sizes).filter(s => s > 1); console.log(`n=${n}: ${all.length} classes, ${all.reduce((a, x) => a + down[all.indexOf ? 0 : 0].length, 0) >= 0 ? down.reduce((a, d) => a + d.length, 0) : 0} cover pairs; set-edge-deck collisions: ${collisions}; stable colours: ${ncol}; non-singleton colour classes: ${nonSingleton.length}${nonSingleton.length ? " sizes " + nonSingleton.join(",") : " => Aut(P_n) trivial"}`);