Section3.4Cubelike Graphs
A cubelike graph is a Cayley graph for \ints_2^d. The connection set of such a graph can be encoded by a d\times m matrix with distinct columns. If M is such a matrix then we can get a list of its columns with cols = M.columns() and we can recover M with M = Matrix(cols).transpose().
The natural choice for the vertices of a cubelike graph are the elements of
xxxxxxxxxx
V = VectorSpace( GF(2)), d)
but these are not hashable. We can make a vector v hashable with v.set_immutable() and use vectors as vertices, or work as follows. Suppose that vls is a list of vectors from a vector space V.
xxxxxxxxxx
G = Graph( [[0..len(vls)-1], lambda i,j: vls[i]-vls[j] in V.list()])
xxxxxxxxxx
P = graphs.PetersenGraph()
D = P.incidence_matrix()
B = D.change_ring( GF(2)) # convert to a matrix over GF(2)
B0 = B.submatrix( nrows=B.nrows()-1) # delete last row
B0
For humans it can be convenient to encode binary vectors of length d as integers between 0 and 2^{d-1}. With G as just defined, its connection set will be the correct set of integers.
xxxxxxxxxx
def cubelike(vecls):
d = len(vecls[0])
VS = VectorSpace(GF(2),d)
return Graph([[0..(2^d-1)], lambda i,j: VS[i]-VS[j] in vecls])
xxxxxxxxxx
PP = cubelike(B0.columns())
PP.am().fcp()