Skip to content

Commit 8e6d6b1

Browse files
committed
Add construction of strongly regular digraph
1 parent 104dde9 commit 8e6d6b1

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,11 @@ REFERENCES:
21742174
.. [Duv1983] J.-P. Duval, Factorizing words over an ordered alphabet,
21752175
J. Algorithms 4 (1983) 363--381.
21762176
2177+
.. [Duv1988] \A. Duval.
2178+
*A directed graph version of strongly regular graphs*,
2179+
Journal of Combinatorial Theory, Series A 47(1) (1988): 71-100.
2180+
:doi:`10.1016/0097-3165(88)90043-X`
2181+
21772182
.. [DW1995] Andreas W.M. Dress and Walter Wenzel, *A Simple Proof of
21782183
an Identity Concerning Pfaffians of Skew Symmetric
21792184
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=f'Strongly regular digraph')
398+
352399
def Paley(self, q):
353400
r"""
354401
Return a Paley digraph on `q` vertices.

0 commit comments

Comments
 (0)