Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 19204
1
r"""
2
Strongly regular graphs
3
=======================
4
5
The ``strongly_regular_graph`` module defines the
6
``StronglyRegularGraph`` class, which represents
7
a strongly regular graph, with some of its properties,
8
such as its stronly regular parameters.
9
10
AUTHORS:
11
12
- Paul Leopardi (2016-10-19): initial version
13
14
"""
15
#*****************************************************************************
16
# Copyright (C) 2016-2017 Paul Leopardi [email protected]
17
#
18
# Distributed under the terms of the GNU General Public License (GPL)
19
# as published by the Free Software Foundation; either version 2 of
20
# the License, or (at your option) any later version.
21
# http://www.gnu.org/licenses/
22
#*****************************************************************************
23
24
from sage.graphs.graph import Graph
25
from sage.matrix.constructor import matrix
26
from sage.misc.lazy_attribute import lazy_attribute
27
from sage.rings.finite_rings.finite_field_constructor import GF
28
29
from boolean_cayley_graphs.graph_improved import GraphImproved
30
31
32
class StronglyRegularGraph(GraphImproved):
33
r"""
34
A strongly regular graph, with lazy attributes for some computed properties.
35
36
The class inherits from ``GraphImproved``, and is initialized either from a graph
37
or from keyword arguments.
38
39
EXAMPLES:
40
41
::
42
43
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
44
sage: g = royle_x_graph()
45
sage: g.is_strongly_regular()
46
True
47
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
48
sage: srg = StronglyRegularGraph(g)
49
sage: srg.is_strongly_regular()
50
True
51
52
TESTS:
53
54
::
55
56
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
57
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
58
sage: g = royle_x_graph()
59
sage: srg = StronglyRegularGraph(g)
60
sage: print(srg)
61
Graph on 64 vertices
62
63
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
64
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
65
sage: g = royle_x_graph()
66
sage: srg = StronglyRegularGraph(g)
67
sage: latex(srg)
68
\begin{tikzpicture}
69
\definecolor{cv0}{rgb}{0.0,0.0,0.0}
70
...
71
\Edge[lw=0.1cm,style={color=cv0v1,},](v0)(v1)
72
...
73
\end{tikzpicture}
74
"""
75
def __init__(self, graph=None, **kwargs):
76
r"""
77
Initialize either from a graph or from keyword arguments.
78
79
TESTS::
80
81
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
82
sage: g = royle_x_graph()
83
sage: g.is_strongly_regular()
84
True
85
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
86
sage: srg = StronglyRegularGraph(g)
87
sage: srg.is_strongly_regular()
88
True
89
"""
90
GraphImproved.__init__(self, graph, **kwargs)
91
92
@lazy_attribute
93
def strongly_regular_parameters(self):
94
r"""
95
The strongly regular parameters of the graph.
96
97
EXAMPLES:
98
99
::
100
101
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
102
sage: g = royle_x_graph()
103
sage: g.is_strongly_regular(parameters=True)
104
(64, 35, 18, 20)
105
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
106
sage: srg = StronglyRegularGraph(g)
107
sage: srg.is_strongly_regular()
108
True
109
sage: srg.strongly_regular_parameters
110
(64, 35, 18, 20)
111
"""
112
return self.is_strongly_regular(parameters=True)
113
114
115
@lazy_attribute
116
def matrix_GF2(self):
117
r"""
118
The adjacency matrix of the graph, over :math:`\mathbb{F}_2`.
119
120
EXAMPLES:
121
122
::
123
124
sage: from boolean_cayley_graphs.bent_function import BentFunction
125
sage: bentf = BentFunction([0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,0])
126
sage: g = bentf.cayley_graph()
127
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
128
sage: sg = StronglyRegularGraph(g)
129
sage: sg.matrix_GF2
130
[0 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0]
131
[0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1]
132
[0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1]
133
[1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1]
134
[0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 1]
135
[0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 0]
136
[0 1 0 0 0 1 0 0 1 0 1 1 0 1 0 0]
137
[1 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0]
138
[0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 1]
139
[0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0]
140
[0 1 0 0 1 0 1 1 0 1 0 0 0 1 0 0]
141
[1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0]
142
[1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1]
143
[1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 0]
144
[1 0 1 1 0 1 0 0 0 1 0 0 0 1 0 0]
145
[0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0]
146
147
"""
148
return matrix(GF(2), self)
149
150
151
@lazy_attribute
152
def rank(self):
153
r"""
154
The 2-rank of the graph.
155
156
EXAMPLES:
157
158
::
159
160
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
161
sage: g = royle_x_graph()
162
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
163
sage: srg = StronglyRegularGraph(g)
164
sage: srg.rank
165
64
166
"""
167
return self.matrix_GF2.rank()
168
169
170
@lazy_attribute
171
def automorphism_group(self):
172
r"""
173
The automorphism group of the graph.
174
175
EXAMPLES:
176
177
::
178
179
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
180
sage: g = royle_x_graph()
181
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
182
sage: srg = StronglyRegularGraph(g)
183
sage: srg.automorphism_group.structure_description()
184
'(C2 x C2 x C2 x C2 x C2 x C2) : S8'
185
"""
186
return Graph.automorphism_group(self)
187
188
189
@lazy_attribute
190
def group_order(self):
191
r"""
192
The order of the automorphism group of the graph.
193
194
EXAMPLES:
195
196
::
197
198
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
199
sage: g = royle_x_graph()
200
sage: from boolean_cayley_graphs.strongly_regular_graph import StronglyRegularGraph
201
sage: srg = StronglyRegularGraph(g)
202
sage: srg.group_order
203
2580480
204
"""
205
return self.automorphism_group.order()
206
207