Skip to content

Commit 9edbe86

Browse files
committed
src/sage/graphs/generators: add Golay code graph pytests
The algorithm to construct the Shortened 000 111 extended binary Golay code graph takes a long time, and we plan to cache its vertices and edges. To ensure that the cached data continue to agree with the construction, we add a new pytest file that checks the two for isomorphism.
1 parent cb03043 commit 9edbe86

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pytest
2+
3+
4+
def test_shortened_000_111_extended_binary_Golay_code_graph():
5+
r"""
6+
Test that Sage produces a graph equal to the one that we get
7+
from this construction.
8+
9+
The construction itself takes a long time.
10+
"""
11+
from sage.coding import codes_catalog
12+
from sage.coding.linear_code import LinearCode
13+
from sage.graphs.generators.distance_regular import (
14+
shortened_000_111_extended_binary_Golay_code_graph
15+
)
16+
from sage.matrix.constructor import matrix
17+
from sage.rings.finite_rings.finite_field_constructor import FiniteField
18+
19+
code = codes_catalog.GolayCode(FiniteField(2))
20+
C_basis = code.basis()
21+
22+
# now special shortening
23+
v = C_basis[0] + C_basis[1] + C_basis[2] # v has 111 at the start
24+
C_basis = C_basis[3:]
25+
C_basis.append(v)
26+
C_basis = list(map(lambda x: x[3:], C_basis))
27+
28+
code = LinearCode(matrix(FiniteField(2), C_basis))
29+
G = code.cosetGraph()
30+
G.name("Shortened 000 111 extended binary Golay code")
31+
assert G.is_distance_regular()
32+
33+
H = shortened_000_111_extended_binary_Golay_code_graph()
34+
assert G == H

src/sage/graphs/generators/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ py.install_sources(
66
'classical_geometries.py',
77
'degree_sequence.py',
88
'families.py',
9+
'generators_test.py',
910
'intersection.py',
1011
'platonic_solids.py',
1112
'random.py',

0 commit comments

Comments
 (0)