From 07adc46931af22160239f507e6d4706a576095b1 Mon Sep 17 00:00:00 2001 From: openresearch Date: Sat, 4 Jul 2026 08:47:32 +0000 Subject: [PATCH] fix(hn): fix Golomb graph construction + EVAL NoneType formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Golomb graph: scale pentagon to side=1 (radius=1/(2*sin(π/5))) Previous construction had 0 edges (vertices not at unit distance) 2. Fix f-string NoneType crash in EVAL writer when welch_wynn is None --- scripts/hn_spectral_database.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/scripts/hn_spectral_database.py b/scripts/hn_spectral_database.py index adeb7caf..9be9bd64 100644 --- a/scripts/hn_spectral_database.py +++ b/scripts/hn_spectral_database.py @@ -47,26 +47,26 @@ def moser_spindle(): return adj, pts, "Moser spindle", 4 def golomb_graph(): - """Golomb graph: 10 vertices, χ=4, unit-distance graph. + """Golomb graph: 10 vertices, unit-distance graph. - Constructed from two 5-cycles sharing a vertex, with unit distances. - Based on Golomb's construction (1970). + Two regular pentagons with side length 1, sharing one vertex. + Pentagon side = 1 → radius = 1/(2*sin(π/5)). """ - # Golomb's 10-vertex graph: two pentagons connected at one vertex - # Each pentagon has side length 1 (unit distance) + r = 1.0 / (2 * math.sin(math.pi / 5)) # circumradius for side=1 pts = [] - # First pentagon centered at origin + # First pentagon, vertex 0 at origin for i in range(5): angle = 2 * math.pi * i / 5 - pts.append((math.cos(angle), math.sin(angle))) - # Second pentagon, rotated and translated - # The connection vertex is at (1, 0) — shared - # Second pentagon centered at (2, 0), rotated by π/5 - cx, cy = 2.0, 0.0 + pts.append((r * math.cos(angle) - r, r * math.sin(angle))) + # Second pentagon, sharing vertex 0, rotated by π/5 for i in range(5): angle = 2 * math.pi * i / 5 + math.pi / 5 - pts.append((cx + math.cos(angle), cy + math.sin(angle))) + # Shift so vertex 0 aligns with first pentagon's vertex 0 + dx = r * math.cos(math.pi / 5) - r + dy = r * math.sin(math.pi / 5) + pts.append((r * math.cos(angle) - r - dx, r * math.sin(angle) - dy)) + pts = hn.remove_duplicates(pts) adj = hn.build_adjacency(pts) n_v = len(pts) n_e = sum(len(a) for a in adj) // 2 @@ -357,11 +357,13 @@ def write_eval(results): "|-------|---|---|-------|------|---------|--------|------------|------|---------|-----|", ] for g in results["graphs"]: + ww = g['welch_wynn'] + ww_str = f"{ww:.4f}" if ww is not None else "N/A" lines.append( f"| {g['description']} | {g['n_vertices']} | {g['n_edges']} | " f"{g['lambda_max']:.4f} | {g['lambda_min']:.4f} | " - f"{g['hoffman_bound']:.4f} | {g['chi_hoffman']} | " - f"{g['welch_wynn']:.4f if g['welch_wynn'] else 'N/A'} | " + f"{g['hoffman_bound']:.4f} if g['hoffman_bound'] is not None else 'inf' | " + f"{g['chi_hoffman']} | {ww_str} | " f"{g['chi_welch_wynn']} | {g['chi_known']} | {g['gap']} |" )