CoCalc Public FilesBoolean-Cayley-graphs / sage-code / cayley_graphs_boolean_dimension_6_sqlite3.ipynb
Author: Paul Leopardi
Compute Environment: Ubuntu 18.04 (Deprecated)

# Cayley graphs of binary bent functions of dimension 6.

Import the required modules.

In [1]:
import os
import sqlite3

from boolean_cayley_graphs.bent_function import BentFunction
from boolean_cayley_graphs.classification_database_sqlite3 import *
from boolean_cayley_graphs.bent_function_cayley_graph_classification import BentFunctionCayleyGraphClassification


Connect to the database that contains the classifications of bent functions in 6 dimensions.

In [2]:
conn = connect_to_database(os.path.join("..","db","p6.db"))


Create a list c for the classifications.

In [3]:
c = [None] * 5


Set c to be the list of classifications for dimension 6, starting from 1, by retrieving these by name. c[0] is None.

In [4]:
for i in range(1,5):
print(i)
name = "p6_"+str(i)
c[i] = select_classification_where_name(conn, name)

1 2 3 4

Display the length of c, the list of classifications.

In [5]:
len(c)

5

Verify that c[0] is None.

In [6]:
print(c[0])

None

Print the algebraic normal form of the bent function corresponding to c[1].

In [7]:
c[1].algebraic_normal_form

x0*x1 + x2*x3 + x4*x5

Produce a report on the classification c[1].

In [8]:
c[1].report(report_on_graph_details=True)

Algebraic normal form of Boolean function: x0*x1 + x2*x3 + x4*x5 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 2 extended Cayley classes in the extended translation class. For each extended Cayley class in the extended translation class: Clique polynomial, strongly regular parameters, rank, and order of a representative graph; and linear code and generator matrix for a representative bent function: EC class 0 : Algebraic normal form of representative: x0*x1 + x2*x3 + x4*x5 Clique polynomial: 64*t^8 + 512*t^7 + 1792*t^6 + 3584*t^5 + 5376*t^4 + 3584*t^3 + 896*t^2 + 64*t + 1 Strongly regular parameters: (64, 28, 12, 12) Rank: 8 Order: 2580480 Linear code from representative: [28, 6] linear code over GF(2) Generator matrix: [1 0 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1] [0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 1 1 1] [0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 1 1 0 0 1] [0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 0 1 1 0 1 1 0] [0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] Linear code is projective. Weight distribution: {0: 1, 12: 28, 16: 35} EC class 1 : Algebraic normal form of representative: x0*x1 + x0 + x1 + x2*x3 + x4*x5 Clique polynomial: 2304*t^6 + 13824*t^5 + 19200*t^4 + 7680*t^3 + 1152*t^2 + 64*t + 1 Strongly regular parameters: (64, 36, 20, 20) Rank: 8 Order: 3317760 Linear code from representative: [36, 6] linear code over GF(2) Generator matrix: [1 0 1 0 1 0 0 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1] [0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 1 1] [0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 1 1 1] [0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1] [0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] Linear code is projective. Weight distribution: {0: 1, 16: 27, 20: 36}

Produce a matrix plot of the weight_class_matrix.

In [9]:
matrix_plot(c[1].weight_class_matrix,cmap='gist_stern')


Produce a matrix plot of bent_cayley_graph_index_matrix, the matrix of indices of extended Cayley classes within the extended translation class.

In [10]:
matrix_plot(c[1].bent_cayley_graph_index_matrix,cmap='gist_stern')


Print the algebraic normal form of the bent function corresponding to c[2].

In [11]:
c[2].algebraic_normal_form

x0*x1*x2 + x0*x3 + x1*x4 + x2*x5

Produce a report on the classification c[2].

In [12]:
c[2].report(report_on_graph_details=True)

Algebraic normal form of Boolean function: x0*x1*x2 + x0*x3 + x1*x4 + x2*x5 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 3 extended Cayley classes in the extended translation class. For each extended Cayley class in the extended translation class: Clique polynomial, strongly regular parameters, rank, and order of a representative graph; and linear code and generator matrix for a representative bent function: EC class 0 : Algebraic normal form of representative: x0*x1*x2 + x0*x3 + x1*x4 + x2*x5 Clique polynomial: 64*t^8 + 512*t^7 + 1792*t^6 + 3584*t^5 + 5376*t^4 + 3584*t^3 + 896*t^2 + 64*t + 1 Strongly regular parameters: (64, 28, 12, 12) Rank: 8 Order: 2580480 Linear code from representative: [28, 6] linear code over GF(2) Generator matrix: [1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 1] [0 1 0 0 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 1 0 0] [0 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 1 0] [0 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 1 1 1 0 1] [0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] Linear code is projective. Weight distribution: {0: 1, 12: 28, 16: 35} EC class 1 : Algebraic normal form of representative: x0*x1*x2 + x0*x3 + x1*x2 + x1*x4 + x2*x5 + x3 Clique polynomial: 256*t^6 + 1536*t^5 + 4352*t^4 + 3584*t^3 + 896*t^2 + 64*t + 1 Strongly regular parameters: (64, 28, 12, 12) Rank: 8 Order: 24576 Linear code from representative: [28, 6] linear code over GF(2) Generator matrix: [1 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0] [0 1 0 0 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 1 0 0] [0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1] [0 0 0 0 1 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0] [0 0 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] Linear code is projective. Weight distribution: {0: 1, 12: 28, 16: 35} EC class 2 : Algebraic normal form of representative: x0*x1*x2 + x0*x1 + x0*x2 + x0*x3 + x0 + x1*x2 + x1*x4 + x1 + x2*x5 + x2 + x3 + x4 + x5 Clique polynomial: 192*t^8 + 1536*t^7 + 8960*t^6 + 19968*t^5 + 20224*t^4 + 7680*t^3 + 1152*t^2 + 64*t + 1 Strongly regular parameters: (64, 36, 20, 20) Rank: 8 Order: 73728 Linear code from representative: [36, 6] linear code over GF(2) Generator matrix: [1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1] [0 1 1 0 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 0 1 1 1 0 1 0 1 1 0 0 1 0 1] [0 0 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1] [0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] Linear code is projective. Weight distribution: {0: 1, 16: 27, 20: 36}

Produce a matrix plot of the weight_class_matrix.

In [13]:
matrix_plot(c[2].weight_class_matrix,cmap='gist_stern')


Produce a matrix plot of bent_cayley_graph_index_matrix, the matrix of indices of extended Cayley classes within the extended translation class.

In [14]:
matrix_plot(c[2].bent_cayley_graph_index_matrix,cmap='gist_stern')


Print the algebraic normal form of the bent function corresponding to c[3].

In [15]:
c[3].algebraic_normal_form

x0*x1*x2 + x0*x1 + x0*x3 + x1*x3*x4 + x1*x5 + x2*x4 + x3*x4

Produce a report on the classification c[3].

In [16]:
c[3].report()

Algebraic normal form of Boolean function: x0*x1*x2 + x0*x1 + x0*x3 + x1*x3*x4 + x1*x5 + x2*x4 + x3*x4 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 4 extended Cayley classes in the extended translation class.

Produce a matrix plot of the weight_class_matrix.

In [17]:
matrix_plot(c[3].weight_class_matrix,cmap='gist_stern')


Produce a matrix plot of bent_cayley_graph_index_matrix, the matrix of indices of extended Cayley classes within the extended translation class.

In [18]:
matrix_plot(c[3].bent_cayley_graph_index_matrix,cmap='gist_stern')


Print the algebraic normal form of the bent function corresponding to c[4].

In [19]:
c[4].algebraic_normal_form

x0*x1*x2 + x0*x3 + x1*x3*x4 + x1*x5 + x2*x3*x5 + x2*x3 + x2*x4 + x2*x5 + x3*x4 + x3*x5

Produce a report on the classification c[4].

In [20]:
c[4].report()

Algebraic normal form of Boolean function: x0*x1*x2 + x0*x3 + x1*x3*x4 + x1*x5 + x2*x3*x5 + x2*x3 + x2*x4 + x2*x5 + x3*x4 + x3*x5 Function is bent. SDP design incidence structure t-design parameters: (True, (2, 64, 28, 12)) Classification of Cayley graphs and classification of Cayley graphs of duals are the same: There are 3 extended Cayley classes in the extended translation class.

Produce a matrix plot of the weight_class_matrix.

In [21]:
matrix_plot(c[4].weight_class_matrix,cmap='gist_stern')


Produce a matrix plot of bent_cayley_graph_index_matrix, the matrix of indices of extended Cayley classes within the extended translation class.

In [22]:
matrix_plot(c[4].bent_cayley_graph_index_matrix,cmap='gist_stern')


Now use an SQL query on the database to determine which extended Cayley classes are repeated between extended translation classes.

In [23]:
curs = conn.cursor()
curs.execute("""
select name, cayley_graph_index, graph_id, count(*)
from matrices, (
select name, bent_function, cayley_graph_index, graph_id
from (
select graph_id
from cayley_graph
group by graph_id
having count (graph_id) > 1L ) as repeats
natural join cayley_graph
natural join bent_function )
as repeats_with_counts
where matrices.bent_function = repeats_with_counts.bent_function
and matrices.bent_cayley_graph_index = repeats_with_counts.cayley_graph_index
group by name, cayley_graph_index, graph_id
order by graph_id
""")
for row in curs:
for x in row:
print(x, end=" ")
print("")


p6_1 0 1 2304 p6_2 0 1 512

We see that extended Cayley class 0 occurs in both extended translation class 1 (2304 Cayley graphs) and extended translation class 2 (512 Cayley graphs).

Close the connection to the database, as we no longer need it.

In [24]:
conn.close()


Now take a look at binary projective two weight codes relevant to dimension 6. References: Tonchev 1996, Tonchev 2006.

In [25]:
from sage.graphs.strongly_regular_db import strongly_regular_from_two_weight_code

from boolean_cayley_graphs.binary_projective_two_weight_codes import *

In [26]:
def linear_code_from_gen_tuple(gen_tuple):
gen_matrix = matrix(GF(2),[list(row) for row in gen_tuple])
return LinearCode(gen_matrix)

In [27]:
gens_27_6_12 = binary_projective_two_weight_27_6_12()

In [28]:
code_27_6_12 = [linear_code_from_gen_tuple(gen_tuple) for gen_tuple in gens_27_6_12]

In [29]:
srg_27_6_12 = [strongly_regular_from_two_weight_code(code).canonical_label(algorithm="sage").graph6_string() for code in code_27_6_12]

In [30]:
print([((i,j),k)
for i in range(1,len(c))
for j in range(len(c[i].cayley_graph_class_list))
for k in range(len(srg_27_6_12))
if c[i].cayley_graph_class_list[j] == srg_27_6_12[k]])

[((1, 1), 0), ((2, 2), 1), ((3, 1), 2), ((3, 3), 3), ((4, 2), 4)]
In [31]:
gens_35_6_16 = binary_projective_two_weight_35_6_16()

In [32]:
code_35_6_16 = [linear_code_from_gen_tuple(gen_tuple) for gen_tuple in gens_35_6_16]

In [33]:
srg_35_6_16 = [strongly_regular_from_two_weight_code(code).complement().canonical_label(algorithm="sage").graph6_string() for code in code_35_6_16]

In [34]:
print([((i,j),k)
for i in range(1,len(c))
for j in range(len(c[i].cayley_graph_class_list))
for k in range(len(srg_35_6_16))
if c[i].cayley_graph_class_list[j] == srg_35_6_16[k]])

[((1, 0), 0), ((1, 0), 1), ((2, 0), 0), ((2, 0), 1), ((2, 1), 2), ((3, 0), 3), ((3, 2), 4), ((4, 0), 6), ((4, 1), 5)]
In [ ]:


In [ ]: