Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 19204
1
r"""
2
The Royle X graph
3
=================
4
5
The ``royle_x_graph`` module defines the
6
``royle_x_graph`` function,
7
which returns a strongly regular graph, as described by Royle [Roy2008]_.
8
9
AUTHORS:
10
11
- Paul Leopardi (2016-10-19): initial version
12
13
"""
14
#*****************************************************************************
15
# Copyright (C) 2016-2017 Paul Leopardi [email protected]
16
#
17
# Distributed under the terms of the GNU General Public License (GPL)
18
# as published by the Free Software Foundation; either version 2 of
19
# the License, or (at your option) any later version.
20
# http://www.gnu.org/licenses/
21
#*****************************************************************************
22
23
from sage.combinat.combination import Combinations
24
from sage.graphs.graph import Graph
25
from sage.modules.vector_integer_dense import vector
26
27
28
def royle_x_graph():
29
r"""
30
Return a strongly regular graph, as described by Royle [Roy2008]_.
31
32
INPUT:
33
34
None.
35
36
OUTPUT:
37
38
An object of class ``Graph``, representing Royle's X graph [Roy2008]_.
39
40
EXAMPLES:
41
42
::
43
44
sage: from boolean_cayley_graphs.royle_x_graph import royle_x_graph
45
sage: g = royle_x_graph()
46
sage: g.is_strongly_regular()
47
True
48
sage: g.is_strongly_regular(parameters=True)
49
(64, 35, 18, 20)
50
51
REFERENCES:
52
53
Royle [Roy2008]_.
54
55
"""
56
n = 8
57
order = 64
58
59
vecs = [vector([1]*n)]
60
for a in Combinations(range(1, n), 4):
61
vecs.append(vector([
62
-1 if x in a else 1
63
for x in range(n)]))
64
for b in Combinations(range(n), 2):
65
vecs.append(vector([
66
-1 if x in b else 1
67
for x in range(n)]))
68
69
return Graph([
70
(i,j) for i in range(order)
71
for j in range(i+1, order)
72
if vecs[i]*vecs[j] == 0])
73
74