Skip to content

Commit 08185d7

Browse files
author
Release Manager
committed
gh-pr-34986: Add construction of strongly regular digraph
Fixes #24682. URL: #34986 Reported by: MatteoCati Reviewer(s): David Coudert
2 parents da48f14 + 5bd750c commit 08185d7

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=52318f4340fa311efa518fc82ad6458b2922415f
3-
md5=6c3a20cfb9bd47cd59f09b2ca2dad664
4-
cksum=2889014807
2+
sha1=2157b8350185e5af083a1655cb574f9a3e18f3cc
3+
md5=06742724b290cd62cc86d4be498b1db9
4+
cksum=4073009205
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
d3f8a79186069e3ceb467052a468a36a521fd3eb
1+
c3a8fdd9d4d03e0c5e73e409408735ecd498ba98

src/doc/en/reference/references/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,11 @@ REFERENCES:
21832183
.. [Duv1983] J.-P. Duval, Factorizing words over an ordered alphabet,
21842184
J. Algorithms 4 (1983) 363--381.
21852185
2186+
.. [Duv1988] \A. Duval.
2187+
*A directed graph version of strongly regular graphs*,
2188+
Journal of Combinatorial Theory, Series A 47(1) (1988): 71-100.
2189+
:doi:`10.1016/0097-3165(88)90043-X`
2190+
21862191
.. [DW1995] Andreas W.M. Dress and Walter Wenzel, *A Simple Proof of
21872192
an Identity Concerning Pfaffians of Skew Symmetric
21882193
Matrices*, Advances in Mathematics, volume 112, Issue 1,

src/sage/graphs/digraph_generators.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,53 @@ def Path(self, n):
349349
g.set_pos({i: (i, 0) for i in range(n)})
350350
return g
351351

352+
def StronglyRegular(self, n):
353+
r"""
354+
Return a Strongly Regular digraph with `n` vertices.
355+
356+
The adjacency matrix of the graph is constructed from a skew Hadamard
357+
matrix of order `n+1`. These graphs were first constructed in [Duv1988]_.
358+
359+
INPUT:
360+
361+
- ``n`` -- integer, the number of vertices of the digraph.
362+
363+
.. SEEALSO::
364+
365+
- :func:`sage.combinat.matrices.hadamard_matrix.skew_hadamard_matrix`
366+
- :meth:`Paley`
367+
368+
EXAMPLES:
369+
370+
A Strongly Regular digraph satisfies the condition `AJ = JA = kJ` where
371+
`A` is the adjacency matrix::
372+
373+
sage: g = digraphs.StronglyRegular(7); g
374+
Strongly regular digraph: Digraph on 7 vertices
375+
sage: A = g.adjacency_matrix()*ones_matrix(7); B = ones_matrix(7)*g.adjacency_matrix()
376+
sage: A == B == A[0, 0]*ones_matrix(7)
377+
True
378+
379+
TESTS:
380+
381+
Wrong parameter::
382+
383+
sage: digraphs.StronglyRegular(73)
384+
Traceback (most recent call last):
385+
...
386+
ValueError: strongly regular digraph with 73 vertices not yet implemented
387+
388+
"""
389+
from sage.combinat.matrices.hadamard_matrix import skew_hadamard_matrix
390+
from sage.matrix.constructor import ones_matrix, identity_matrix
391+
if skew_hadamard_matrix(n + 1, existence=True) is not True:
392+
raise ValueError(f'strongly regular digraph with {n} vertices not yet implemented')
393+
394+
H = skew_hadamard_matrix(n + 1, skew_normalize=True)
395+
M = H[1:, 1:]
396+
M = (M + ones_matrix(n)) / 2 - identity_matrix(n)
397+
return DiGraph(M, format='adjacency_matrix', name='Strongly regular digraph')
398+
352399
def Paley(self, q):
353400
r"""
354401
Return a Paley digraph on `q` vertices.

0 commit comments

Comments
 (0)