# Database of distance regular graphs#

In this module we construct several distance regular graphs and group them in a function that maps intersection arrays to graphs.

For a survey on distance-regular graph see [BCN1989] or [VDKT2016].

EXAMPLES:

sage: G = graphs.cocliques_HoffmannSingleton()
sage: G.is_distance_regular()
True
sage: H = graphs.distance_regular_graph([15, 14, 10, 3, 1, 5, 12, 15])
sage: H == G
True
sage: G = graphs.distance_regular_graph([27, 10, 1, 1, 10, 27])
sage: G.is_distance_regular(True)
([27, 10, 1, None], [None, 1, 10, 27])

>>> from sage.all import *
>>> G = graphs.cocliques_HoffmannSingleton()
>>> G.is_distance_regular()
True
>>> H = graphs.distance_regular_graph([Integer(15), Integer(14), Integer(10), Integer(3), Integer(1), Integer(5), Integer(12), Integer(15)])
>>> H == G
True
>>> G = graphs.distance_regular_graph([Integer(27), Integer(10), Integer(1), Integer(1), Integer(10), Integer(27)])
>>> G.is_distance_regular(True)
([27, 10, 1, None], [None, 1, 10, 27])


AUTHORS:

• Ivo Maffei (2020-07-28): initial version

sage.graphs.generators.distance_regular.AlternatingFormsGraph(n, q)[source]#

Return the alternating forms graph with the given parameters.

This builds a graph whose vertices are all $$nxn$$ skew-symmetric matrices over $$GF(q)$$ with zero diagonal. Two vertices are adjacent if and only if the difference of the two matrices has rank 2.

This grap is distance-regular with classical parameters $$(\lfloor \frac n 2 \rfloor, q^2, q^2 - 1, q^{2 \lceil \frac n 2 \rceil -1})$$.

INPUT:

• n – integer

• q – a prime power

EXAMPLES:

sage: G = graphs.AlternatingFormsGraph(5, 2)  # long time
sage: G.is_distance_regular(True)  # long time
([155, 112, None], [None, 1, 20])

>>> from sage.all import *
>>> G = graphs.AlternatingFormsGraph(Integer(5), Integer(2))  # long time
>>> G.is_distance_regular(True)  # long time
([155, 112, None], [None, 1, 20])


REFERENCES:

See [BCN1989] pp. 282-284 for a rather detailed discussion, otherwise see [VDKT2016] p. 22.

sage.graphs.generators.distance_regular.BilinearFormsGraph(d, e, q)[source]#

Return a bilinear forms graph with the given parameters.

This builds a graph whose vertices are all $$dxe$$ matrices over $$GF(q)$$. Two vertices are adjacent if the difference of the two matrices has rank 1.

The graph is distance-regular with classical parameters $$(\min(d, e), q, q-1 , q^{\max(d, e)}-1)$$.

INPUT:

• d, e – integers; dimension of the matrices

• q – integer; a prime power

EXAMPLES:

sage: # needs sage.modules
sage: G = graphs.BilinearFormsGraph(3, 3, 2)
sage: G.is_distance_regular(True)
([49, 36, 16, None], [None, 1, 6, 28])
sage: G = graphs.BilinearFormsGraph(3,3,3)      # not tested (20 s)             # needs sage.rings.finite_rings
sage: G.order()                         # not tested (due to above)             # needs sage.rings.finite_rings
19683
sage: G = graphs.BilinearFormsGraph(3, 4, 2)    # long time                     # needs sage.rings.finite_rings
sage: G.is_distance_regular(True)       # long time                             # needs sage.rings.finite_rings
([105, 84, 48, None], [None, 1, 6, 28])

>>> from sage.all import *
>>> # needs sage.modules
>>> G = graphs.BilinearFormsGraph(Integer(3), Integer(3), Integer(2))
>>> G.is_distance_regular(True)
([49, 36, 16, None], [None, 1, 6, 28])
>>> G = graphs.BilinearFormsGraph(Integer(3),Integer(3),Integer(3))      # not tested (20 s)             # needs sage.rings.finite_rings
>>> G.order()                         # not tested (due to above)             # needs sage.rings.finite_rings
19683
>>> G = graphs.BilinearFormsGraph(Integer(3), Integer(4), Integer(2))    # long time                     # needs sage.rings.finite_rings
>>> G.is_distance_regular(True)       # long time                             # needs sage.rings.finite_rings
([105, 84, 48, None], [None, 1, 6, 28])


REFERENCES:

See [BCN1989] pp. 280-282 for a rather detailed discussion, otherwise see [VDKT2016] p. 21.

sage.graphs.generators.distance_regular.ConwaySmith_for_3S7()[source]#

Return the Conway-Smith graph related to $$3 Sym(7)$$.

This is a distance-regular graph with intersection array $$[10, 6, 4, 1; 1, 2, 6, 10]$$.

EXAMPLES:

sage: G = graphs.ConwaySmith_for_3S7()                                          # needs sage.modules sage.rings.finite_rings sage.rings.number_field
sage: G.is_distance_regular(True)                                               # needs sage.modules sage.rings.finite_rings sage.rings.number_field
([10, 6, 4, 1, None], [None, 1, 2, 6, 10])

>>> from sage.all import *
>>> G = graphs.ConwaySmith_for_3S7()                                          # needs sage.modules sage.rings.finite_rings sage.rings.number_field
>>> G.is_distance_regular(True)                                               # needs sage.modules sage.rings.finite_rings sage.rings.number_field
([10, 6, 4, 1, None], [None, 1, 2, 6, 10])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 399.

sage.graphs.generators.distance_regular.DoubleGrassmannGraph(q, e)[source]#

Return the bipartite double of the distance-$$e$$ graph of the Grassmann graph $$J_q(n,e)$$.

This graph can also be descirbed as follows: Let $$V$$ be the vector space of dimension $$n$$ over $$GF(q)$$. The vertex set is the set of $$e+1$$ or $$e$$ subspaces of $$V$$. Two vertices are adjacent if one subspace is contained in the other.

This graph is distance-transitive.

INPUT:

• q – a prime power

• e – integer

EXAMPLES:

sage: G = graphs.DoubleGrassmannGraph(2,1)                                      # needs sage.modules
sage: G.diameter()                                                              # needs sage.modules
3
sage: G.is_distance_regular(True)                                               # needs sage.modules
([3, 2, 2, None], [None, 1, 1, 3])

>>> from sage.all import *
>>> G = graphs.DoubleGrassmannGraph(Integer(2),Integer(1))                                      # needs sage.modules
>>> G.diameter()                                                              # needs sage.modules
3
>>> G.is_distance_regular(True)                                               # needs sage.modules
([3, 2, 2, None], [None, 1, 1, 3])


REFERENCES:

See [BCN1989] pp. 272, 273 or [VDKT2016] p. 25.

sage.graphs.generators.distance_regular.DoubleOddGraph(n)[source]#

Return the double odd graph on $$2n+1$$ points.

The graph is obtained using the subsets of size $$n$$ and $$n+1$$ of $${1, 2, ..., 2n+1}$$ as vertices. Two vertices are adjacent if one is included in the other.

The graph is distance-transitive.

INPUT:

• n – integer; must be greater than 0

EXAMPLES:

sage: G = graphs.DoubleOddGraph(5)
sage: G.is_distance_regular(True)
([6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, None],
[None, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6])
sage: G = graphs.DoubleOddGraph(3)
sage: G.diameter()
7
sage: G.is_distance_regular(True)
([4, 3, 3, 2, 2, 1, 1, None], [None, 1, 1, 2, 2, 3, 3, 4])

>>> from sage.all import *
>>> G = graphs.DoubleOddGraph(Integer(5))
>>> G.is_distance_regular(True)
([6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, None],
[None, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6])
>>> G = graphs.DoubleOddGraph(Integer(3))
>>> G.diameter()
7
>>> G.is_distance_regular(True)
([4, 3, 3, 2, 2, 1, 1, None], [None, 1, 1, 2, 2, 3, 3, 4])


REFERENCES:

See [BCN1989] pp. 259-261 or [VDKT2016] p. 25.

sage.graphs.generators.distance_regular.DoublyTruncatedWittGraph()[source]#

Return the doubly truncated Witt graph.

This builds the truncated Witt graph, then removes all vertices whose codeword start with a 1.

The graph is distance-regular with intersection array $$[7,6,4,4;1,1,1,6]$$.

EXAMPLES:

sage: G = graphs.DoublyTruncatedWittGraph()                                     # needs sage.libs.pari sage.modules
sage: G.is_distance_regular(True)                                               # needs sage.libs.pari sage.modules
([7, 6, 4, 4, None], [None, 1, 1, 1, 6])

>>> from sage.all import *
>>> G = graphs.DoublyTruncatedWittGraph()                                     # needs sage.libs.pari sage.modules
>>> G.is_distance_regular(True)                                               # needs sage.libs.pari sage.modules
([7, 6, 4, 4, None], [None, 1, 1, 1, 6])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 368.

sage.graphs.generators.distance_regular.FosterGraph3S6()[source]#

Return the Foster graph for $$3.Sym(6)$$.

This graph is distance-regular with intersection array $$[6, 4, 2, 1; 1, 1, 4, 6]$$.

The graph is also distance transitive.

EXAMPLES:

sage: G = graphs.FosterGraph3S6()                                               # needs sage.libs.gap
sage: G.is_distance_regular(True)                                               # needs sage.libs.gap
([6, 4, 2, 1, None], [None, 1, 1, 4, 6])

>>> from sage.all import *
>>> G = graphs.FosterGraph3S6()                                               # needs sage.libs.gap
>>> G.is_distance_regular(True)                                               # needs sage.libs.gap
([6, 4, 2, 1, None], [None, 1, 1, 4, 6])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 397.

sage.graphs.generators.distance_regular.GeneralisedDodecagonGraph(s, t)[source]#

Return the point-graph of a generalised dodecagon of order $$(s,t)$$.

INPUT:

• s, t – integers; order of the generalised dodecagon

EXAMPLES:

sage: # optional - gap_package_atlasrep internet
sage: G = graphs.GeneralisedDodecagonGraph(1, 5)
sage: G.is_distance_regular(True)
([6, 5, 5, 5, 5, 5, None], [None, 1, 1, 1, 1, 1, 6])
sage: H = graphs.GeneralisedDodecagonGraph(5, 1)
sage: H.order()
23436
sage: H.is_distance_regular(True)       # not tested (6 min)
([10, 5, 5, 5, 5, 5, None], [None, 1, 1, 1, 1, 1, 2])

>>> from sage.all import *
>>> # optional - gap_package_atlasrep internet
>>> G = graphs.GeneralisedDodecagonGraph(Integer(1), Integer(5))
>>> G.is_distance_regular(True)
([6, 5, 5, 5, 5, 5, None], [None, 1, 1, 1, 1, 1, 6])
>>> H = graphs.GeneralisedDodecagonGraph(Integer(5), Integer(1))
>>> H.order()
23436
>>> H.is_distance_regular(True)       # not tested (6 min)
([10, 5, 5, 5, 5, 5, None], [None, 1, 1, 1, 1, 1, 2])


Note

This function indirectly uses the GAP’s AtlasRep package. Thus you may need an internet connection and the optional Sage’s package gap_packages.

REFERENCES:

See [BCN1989] pp. 200-205 for a discussion of distance-regular graphs from generalised polygons.

sage.graphs.generators.distance_regular.GeneralisedHexagonGraph(s, t)[source]#

Return the point-graph of a generalised hexagon of order $$(s,t)$$.

INPUT:

• s, t – integers; order of the generalised hexagon

EXAMPLES:

sage: # needs sage.libs.gap
sage: G = graphs.GeneralisedHexagonGraph(5, 5)          # optional - gap_package_atlasrep internet
sage: G.is_distance_regular(True)                       # optional - gap_package_atlasrep internet
([30, 25, 25, None], [None, 1, 1, 6])
sage: G = graphs.GeneralisedHexagonGraph(7, 1)
sage: G.is_distance_regular(True)
([14, 7, 7, None], [None, 1, 1, 2])
sage: graphs.GeneralisedHexagonGraph(1, 1)
Cycle graph: Graph on 6 vertices

>>> from sage.all import *
>>> # needs sage.libs.gap
>>> G = graphs.GeneralisedHexagonGraph(Integer(5), Integer(5))          # optional - gap_package_atlasrep internet
>>> G.is_distance_regular(True)                       # optional - gap_package_atlasrep internet
([30, 25, 25, None], [None, 1, 1, 6])
>>> G = graphs.GeneralisedHexagonGraph(Integer(7), Integer(1))
>>> G.is_distance_regular(True)
([14, 7, 7, None], [None, 1, 1, 2])
>>> graphs.GeneralisedHexagonGraph(Integer(1), Integer(1))
Cycle graph: Graph on 6 vertices


Note

This function uses the GAP’s AtlasRep package to build GHs of order $$(q, q)$$, $$(q, q^3)$$ or $$(q^3, q)$$. For those graphs you need an internet connection and Sage’s optional package gap_packages.

REFERENCES:

See [BCN1989] pp. 200-205 for a discussion of distance-regular graphs from generalised polygons.

sage.graphs.generators.distance_regular.GeneralisedOctagonGraph(s, t)[source]#

Return the point-graph of a generalised octagon of order $$(s,t)$$.

INPUT:

• s, t – integers; order of the generalised octagon

EXAMPLES:

sage: # needs sage.libs.gap
sage: G = graphs.GeneralisedOctagonGraph(1, 4)
sage: G.is_distance_regular(True)
([5, 4, 4, 4, None], [None, 1, 1, 1, 5])
sage: G = graphs.GeneralisedOctagonGraph(2, 4)          # optional - gap_package_atlasrep internet
sage: G.is_distance_regular(True)                       # optional - gap_package_atlasrep internet
([10, 8, 8, 8, None], [None, 1, 1, 1, 5])
sage: G = graphs.GeneralisedOctagonGraph(5, 1)
sage: G.is_distance_regular(True)
([10, 5, 5, 5, None], [None, 1, 1, 1, 2])

>>> from sage.all import *
>>> # needs sage.libs.gap
>>> G = graphs.GeneralisedOctagonGraph(Integer(1), Integer(4))
>>> G.is_distance_regular(True)
([5, 4, 4, 4, None], [None, 1, 1, 1, 5])
>>> G = graphs.GeneralisedOctagonGraph(Integer(2), Integer(4))          # optional - gap_package_atlasrep internet
>>> G.is_distance_regular(True)                       # optional - gap_package_atlasrep internet
([10, 8, 8, 8, None], [None, 1, 1, 1, 5])
>>> G = graphs.GeneralisedOctagonGraph(Integer(5), Integer(1))
>>> G.is_distance_regular(True)
([10, 5, 5, 5, None], [None, 1, 1, 1, 2])


Note

This function uses the GAP’s AtlasRep package to build the graphs of order $$(2, 4)$$ or $$(4, 2)$$. For those graphs you need an internet connection and Sage’s optional package gap_packages.

REFERENCES:

See [BCN1989] pp. 200-205 for a discussion of distance-regular graphs from generalised polygons.

sage.graphs.generators.distance_regular.GrassmannGraph(q, n, input_e)[source]#

Return the Grassmann graph with parameters $$(q, n, e)$$.

This builds the Grassmann graph $$J_q(n,e)$$. That is, for a vector space $$V = \mathbb F(q)^n$$ the output is the graph on the subspaces of dimension $$e$$ where two subspaces are adjacent if their intersection has dimension $$e-1$$.

This graph is distance-regular with classical parameters $$(\min(e, n-e), q, q, \genfrac {[}{]} {0pt} {} {n-e+1} 1 _q -1)$$

INPUT:

• q – a prime power

• n, e – integers with $$n > e+1$$

EXAMPLES:

sage: G = graphs.GrassmannGraph(2, 4, 2)                                        # needs sage.modules sage.rings.finite_rings
sage: G.is_distance_regular(True)                                               # needs sage.modules sage.rings.finite_rings
([18, 8, None], [None, 1, 9])

>>> from sage.all import *
>>> G = graphs.GrassmannGraph(Integer(2), Integer(4), Integer(2))                                        # needs sage.modules sage.rings.finite_rings
>>> G.is_distance_regular(True)                                               # needs sage.modules sage.rings.finite_rings
([18, 8, None], [None, 1, 9])


REFERENCES:

See [BCN1989] pp. 268-272 or [VDKT2016] p. 21.

sage.graphs.generators.distance_regular.HalfCube(n)[source]#

Return the halved cube in $$n$$ dimensions.

The graph is distance-regular with classical parameters $$(\lfloor \frac n 2 \rfloor, 1, 2, 2 \lceil \frac n 2 \rceil -1)$$.

INPUT:

• n – integer; must be greater than 2

EXAMPLES:

sage: G = graphs.HalfCube(8)
sage: G.is_distance_regular(True)
([28, 15, 6, 1, None], [None, 1, 6, 15, 28])
sage: G = graphs.HalfCube(4)
sage: G.is_distance_regular(True)
([6, 1, None], [None, 1, 6])

>>> from sage.all import *
>>> G = graphs.HalfCube(Integer(8))
>>> G.is_distance_regular(True)
([28, 15, 6, 1, None], [None, 1, 6, 15, 28])
>>> G = graphs.HalfCube(Integer(4))
>>> G.is_distance_regular(True)
([6, 1, None], [None, 1, 6])


REFERENCES:

See [BCN1989] pp. 264, 265 or [VDKT2016] p. 21. This construction can be found on Wikipedia article Halved_cube_graph#Equivalent_constructions

sage.graphs.generators.distance_regular.HermitianFormsGraph(n, r)[source]#

Return the Hermitian forms graph with the given parameters.

We build a graph whose vertices are all $$n \times n$$ Hermitian matrices over GF(r^2). Two vertices are adjacent if the difference of the two vertices has rank 1.

This graph is distance-regular with classical parameters $$(n, - r, - r - 1, - (- r)^d - 1)$$.

INPUT:

• n – integer

• r – a prime power

EXAMPLES:

sage: # needs sage.modules sage.rings.finite_rings
sage: G = graphs.HermitianFormsGraph(2, 2)
sage: G.is_distance_regular(True)
([5, 4, None], [None, 1, 2])
sage: G = graphs.HermitianFormsGraph(3, 3)      # not tested (2 min)
sage: G.order()                         # not tested (bacuase of the above)
19683

>>> from sage.all import *
>>> # needs sage.modules sage.rings.finite_rings
>>> G = graphs.HermitianFormsGraph(Integer(2), Integer(2))
>>> G.is_distance_regular(True)
([5, 4, None], [None, 1, 2])
>>> G = graphs.HermitianFormsGraph(Integer(3), Integer(3))      # not tested (2 min)
>>> G.order()                         # not tested (bacuase of the above)
19683


REFERENCES:

See [BCN1989] p. 285 or [VDKT2016] p. 22.

The graph is distance-transitive with automorphism group $$3.M_{22}$$.

EXAMPLES:

sage: G = graphs.IvanovIvanovFaradjevGraph()            # optional - internet gap_package_atlasrep
sage: G.is_distance_regular(True)                       # optional - internet gap_package_atlasrep
([7, 6, 4, 4, 4, 1, 1, 1, None], [None, 1, 1, 1, 2, 4, 4, 6, 7])

>>> from sage.all import *
>>> G = graphs.IvanovIvanovFaradjevGraph()            # optional - internet gap_package_atlasrep
>>> G.is_distance_regular(True)                       # optional - internet gap_package_atlasrep
([7, 6, 4, 4, 4, 1, 1, 1, None], [None, 1, 1, 1, 2, 4, 4, 6, 7])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 369.

sage.graphs.generators.distance_regular.J2Graph()[source]#

Return the distance-transitive graph with automorphism group $$J_2$$.

EXAMPLES:

sage: G = graphs.J2Graph()                              # optional - internet gap_package_atlasrep
sage: G.is_distance_regular(True)                       # optional - internet gap_package_atlasrep
([10, 8, 8, 2, None], [None, 1, 1, 4, 5])

>>> from sage.all import *
>>> G = graphs.J2Graph()                              # optional - internet gap_package_atlasrep
>>> G.is_distance_regular(True)                       # optional - internet gap_package_atlasrep
([10, 8, 8, 2, None], [None, 1, 1, 4, 5])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 408.

sage.graphs.generators.distance_regular.LargeWittGraph()[source]#

Return the large Witt graph.

This is a distance-regular graph with intersection array $$[30,28,24;1,3,15]$$.

EXAMPLES:

sage: g = graphs.LargeWittGraph()                                               # needs sage.libs.pari sage.modules
sage: g.is_distance_regular(True)                                               # needs sage.libs.pari sage.modules
([30, 28, 24, None], [None, 1, 3, 15])

>>> from sage.all import *
>>> g = graphs.LargeWittGraph()                                               # needs sage.libs.pari sage.modules
>>> g.is_distance_regular(True)                                               # needs sage.libs.pari sage.modules
([30, 28, 24, None], [None, 1, 3, 15])


REFERENCES:

A description of this graph can be found in [BCN1989] p. 366. This construction is taken from http://mathworld.wolfram.com/LargeWittGraph.html

sage.graphs.generators.distance_regular.LeonardGraph()[source]#

Return the Leonard graph.

The graph is distance-regular with intersection array $$[12, 11, 10, 7; 1, 2, 5, 12]$$.

EXAMPLES:

sage: G = graphs.LeonardGraph()                                                # needs sage.combinat sage.modules
sage: G.is_distance_regular(True)                                              # needs sage.combinat sage.modules
([12, 11, 10, 7, None], [None, 1, 2, 5, 12])

>>> from sage.all import *
>>> G = graphs.LeonardGraph()                                                # needs sage.combinat sage.modules
>>> G.is_distance_regular(True)                                              # needs sage.combinat sage.modules
([12, 11, 10, 7, None], [None, 1, 2, 5, 12])


REFERENCES:

For a description of this graph see [BCN1989] p. 371.

sage.graphs.generators.distance_regular.TruncatedWittGraph()[source]#

Return the truncated Witt graph.

This builds the large Witt graph, then removes all vertices whose codeword start with a 1.

The graph is distance-regular with intersection array $$[15,14,12;1,1,9]$$.

EXAMPLES:

sage: # long time, needs sage.libs.pari sage.modules
sage: G = graphs.TruncatedWittGraph()
sage: G.is_distance_regular(True)
([15, 14, 12, None], [None, 1, 1, 9])

>>> from sage.all import *
>>> # long time, needs sage.libs.pari sage.modules
>>> G = graphs.TruncatedWittGraph()
>>> G.is_distance_regular(True)
([15, 14, 12, None], [None, 1, 1, 9])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 367.

sage.graphs.generators.distance_regular.UstimenkoGraph(m, q)[source]#

Return the Ustimenko graph with parameters $$(m, q)$$.

This is the distance 1 or 2 graph of the dual polar graph $$C_{m-1}(q)$$. The graph is distance-regular with parameters $$(d,q^2, \binom{3}{1}_q -1, \binom{m+1}{1}_q -1)$$, where $$\binom{n}{k}_q$$ is the $$q$$-binomial coefficient.

INPUT:

• m, q – integers; $$q$$ must be a prime power and $$m > 1$$

EXAMPLES:

sage: G = graphs.UstimenkoGraph(4, 2)                                           # needs sage.libs.gap
sage: G.is_distance_regular(True)                                               # needs sage.libs.gap
([70, 32, None], [None, 1, 35])

>>> from sage.all import *
>>> G = graphs.UstimenkoGraph(Integer(4), Integer(2))                                           # needs sage.libs.gap
>>> G.is_distance_regular(True)                                               # needs sage.libs.gap
([70, 32, None], [None, 1, 35])


REFERENCES:

See [BCN1989] p. 279 or [VDKT2016] p. 22.

sage.graphs.generators.distance_regular.cocliques_HoffmannSingleton()[source]#

Return the graph obtained from the cocliques of the Hoffmann-Singleton graph.

This is a distance-regular graph with intersection array $$[15, 14, 10, 3; 1, 5, 12, 15]$$.

EXAMPLES:

sage: G = graphs.cocliques_HoffmannSingleton()
sage: G.is_distance_regular(True)
([15, 14, 10, 3, None], [None, 1, 5, 12, 15])

>>> from sage.all import *
>>> G = graphs.cocliques_HoffmannSingleton()
>>> G.is_distance_regular(True)
([15, 14, 10, 3, None], [None, 1, 5, 12, 15])


REFERENCES:

The construction of this graph can be found in [BCN1989] p. 392.

sage.graphs.generators.distance_regular.distance_3_doubly_truncated_Golay_code_graph()[source]#

Return a distance-regular graph with intersection array $$[9, 8, 6, 3; 1, 1, 3, 8]$$.

EXAMPLES:

sage: # long time, needs sage.modules sage.rings.finite_rings
sage: G = graphs.distance_3_doubly_truncated_Golay_code_graph()
sage: G.is_distance_regular(True)       # long time (due to above)
([9, 8, 6, 3, None], [None, 1, 1, 3, 8])

>>> from sage.all import *
>>> # long time, needs sage.modules sage.rings.finite_rings
>>> G = graphs.distance_3_doubly_truncated_Golay_code_graph()
>>> G.is_distance_regular(True)       # long time (due to above)
([9, 8, 6, 3, None], [None, 1, 1, 3, 8])


ALGORITHM:

Compute the binary Golay code and truncate it twice. Compute its coset graph. Take a vertex and compute the set of vertices at distance 3 from the vertex chosen. This set constitutes the set of vertices of our distance-regular graph. Moreover we have an edge $$(u,v)$$ if the coset graph contains such edge.

REFERENCES:

Description and construction of this graph are taken from [BCN1989] p. 364.

sage.graphs.generators.distance_regular.distance_regular_graph(arr, existence=False, check=True)[source]#

Return a distance-regular graph with the intersection array given.

INPUT:

• arr – list; intersection array of the graph

• existence – boolean (optional); instead of building the graph return:

• True – if a graph with the given intersection array exists;

• False – if there is no graph with the given intersection array;

• Unknown – if Sage doesn’t know if such a graph exists.

• check – boolean (default: True); if True, then checks that the result of this function has the given intersection array

EXAMPLES:

sage: graphs.distance_regular_graph([21,20,16,1,2,12], existence=True)
True
sage: G = graphs.distance_regular_graph([12,11,10,7,1,2,5,12], check=False)     # needs sage.combinat sage.modules
sage: G.is_distance_regular(True)                                               # needs sage.combinat sage.modules
([12, 11, 10, 7, None], [None, 1, 2, 5, 12])

>>> from sage.all import *
>>> graphs.distance_regular_graph([Integer(21),Integer(20),Integer(16),Integer(1),Integer(2),Integer(12)], existence=True)
True
>>> G = graphs.distance_regular_graph([Integer(12),Integer(11),Integer(10),Integer(7),Integer(1),Integer(2),Integer(5),Integer(12)], check=False)     # needs sage.combinat sage.modules
>>> G.is_distance_regular(True)                                               # needs sage.combinat sage.modules
([12, 11, 10, 7, None], [None, 1, 2, 5, 12])


REFERENCES:

See [BCN1989] and [VDKT2016].

sage.graphs.generators.distance_regular.graph_3O73()[source]#

Return the graph related to the group $$3 O(7,3)$$.

This graph is distance-regular with intersection array $$[117, 80, 24, 1; 1, 12, 80, 117]$$.

The graph is also distance transitive with $$3.O(7,3)$$ as automorphism group

EXAMPLES:

sage: G = graphs.graph_3O73()                           # optional - internet gap_package_atlasrep
sage: G.is_distance_regular(True)                       # optional - internet gap_package_atlasrep
([117, 80, 24, 1, None], [None, 1, 12, 80, 117])

>>> from sage.all import *
>>> G = graphs.graph_3O73()                           # optional - internet gap_package_atlasrep
>>> G.is_distance_regular(True)                       # optional - internet gap_package_atlasrep
([117, 80, 24, 1, None], [None, 1, 12, 80, 117])


REFERENCES:

A description and construction of this graph can be found in [BCN1989] p. 400.

Return the point graph of the generalised quadrangle with order $$(s, t)$$ after removing one of its spreads.

These graphs are antipodal covers of complete graphs and, in particular, distance-regular graphs of diameter 3.

INPUT:

• s, t – integers; order of the generalised quadrangle

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import \
sage: G = graph_from_GQ_spread(4, 16)                                          # needs sage.libs.pari
sage: G.is_distance_regular(True)                                              # needs sage.libs.pari
([64, 60, 1, None], [None, 1, 15, 64])

>>> from sage.all import *
>>> G = graph_from_GQ_spread(Integer(4), Integer(16))                                          # needs sage.libs.pari
>>> G.is_distance_regular(True)                                              # needs sage.libs.pari
([64, 60, 1, None], [None, 1, 15, 64])


REFERENCES:

The graphs constructed here follow [BCN1989] pp. 385, 386.

sage.graphs.generators.distance_regular.graph_with_classical_parameters(d, b, alpha_in, beta_in, gamma)[source]#

Return the graph with the classical parameters given.

The last parameter gamma is meant to be an element of the enum ClassicalParametersGraph used to identify the family of graphs to construct. In particular this function doesn’t build any sporadic graph. To build such a graph use sage.graphs.generators.distance_regular.distance_regular_graph().

INPUT:

• d, b, alpha_in, beta_in – numbers; the parameters of the graph; d and b must be integers

• gamma – element of the enum ClassicalParametersGraph

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import *
sage: graph_with_classical_parameters(3, 1, 1, 3, 1)
Johnson graph with parameters 6,3: Graph on 20 vertices

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import *
>>> graph_with_classical_parameters(Integer(3), Integer(1), Integer(1), Integer(3), Integer(1))
Johnson graph with parameters 6,3: Graph on 20 vertices


The last parameter is very important as it takes precedence. This function will not check that the other four parameters match the correct family. Use sage.graphs.generators.distance_regular.is_classical_parameters_graph() to check the parameters:

sage: from sage.graphs.generators.distance_regular import *
sage: graph_with_classical_parameters(3, 1, 1, 3, 2)
Hamming Graph with parameters 3,4: Graph on 64 vertices
sage: G = _; G.is_distance_regular(True)
([9, 6, 3, None], [None, 1, 2, 3])
sage: is_classical_parameters_graph([9, 6, 3, 1, 2, 3])                         # needs sage.combinat
(3, 1, 0, 3, 2)

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import *
>>> graph_with_classical_parameters(Integer(3), Integer(1), Integer(1), Integer(3), Integer(2))
Hamming Graph with parameters 3,4: Graph on 64 vertices
>>> G = _; G.is_distance_regular(True)
([9, 6, 3, None], [None, 1, 2, 3])
>>> is_classical_parameters_graph([Integer(9), Integer(6), Integer(3), Integer(1), Integer(2), Integer(3)])                         # needs sage.combinat
(3, 1, 0, 3, 2)


Two families of graphs are not implemented yet:

sage: from sage.graphs.generators.distance_regular import *
sage: graph_with_classical_parameters(3, 16, 15, 511, 17)
Traceback (most recent call last):
...
NotImplementedError: Graph would be too big
sage: graph_with_classical_parameters(3, 16, 30, 1022, 16)
Traceback (most recent call last):
...
NotImplementedError: Graph would be too big

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import *
>>> graph_with_classical_parameters(Integer(3), Integer(16), Integer(15), Integer(511), Integer(17))
Traceback (most recent call last):
...
NotImplementedError: Graph would be too big
>>> graph_with_classical_parameters(Integer(3), Integer(16), Integer(30), Integer(1022), Integer(16))
Traceback (most recent call last):
...
NotImplementedError: Graph would be too big


REFERENCES:

See [BCN1989] chapter 9 for a discussion of distance-regular graphs with classical parameters. See also [VDKT2016] section 3.1.1.

sage.graphs.generators.distance_regular.is_classical_parameters_graph(array)[source]#

Return a tuple of parameters representing the array given. If such no tuple can be produced, it returns False.

Given an intersection array, if it represents a family of distance-regular graphs with classical parameters, then this function returns a tuple consisting of the parameters $$(d, b, \alpha, \beta)$$ and a fourth parameter which is the enum CalssicalParametersGraph indicating the family with the given itersection array. If the array doesn’t belong to any classical parameter graph, then this function returns False. If the array belongs to a sporadic graph rather than a family of graphs, then the function returns False. This is to reduce the overlap with sage.graphs.generators.distance_regular._sporadic_graph_database.

Note

The array given as an input is expected to be an intersection array. If this is not the case, then some exception may be raised.

INPUT:

• array – list; an intersection array

OUTPUT:

False or a tuple (d, b, alpha, beta, gamma).

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import \
....: is_classical_parameters_graph
sage: G = graphs.HammingGraph(5, 4)
sage: G.is_distance_regular(True)
([15, 12, 9, 6, 3, None], [None, 1, 2, 3, 4, 5])
sage: is_classical_parameters_graph([15, 12, 9, 6, 3, 1, 2, 3, 4, 5])           # needs sage.combinat
(5, 1, 0, 3, 2)

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import is_classical_parameters_graph
>>> G = graphs.HammingGraph(Integer(5), Integer(4))
>>> G.is_distance_regular(True)
([15, 12, 9, 6, 3, None], [None, 1, 2, 3, 4, 5])
>>> is_classical_parameters_graph([Integer(15), Integer(12), Integer(9), Integer(6), Integer(3), Integer(1), Integer(2), Integer(3), Integer(4), Integer(5)])           # needs sage.combinat
(5, 1, 0, 3, 2)


REFERENCES:

See [BCN1989] chapter 9 for a discussion of distance-regular graphs with classical parameters. See [BCN1989] chapter 6.2 for a method to compute the classical parameters of a graph. See also [VDKT2016] section 3.1.1.

Return a pair $$(s, t)$$ if the graph obtained from a GQ of order $$(s, t)$$ with a spread has the intersection array passed. We also require that such GQ can be built by Sage. If no such pair exists, then return False.

INPUT:

• arr – list; an intersection array

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import \
sage: is_from_GQ_spread([125, 120, 1, 1, 24, 125])                             # needs sage.libs.pari
(5, 25)
sage: G = graph_from_GQ_spread(5, 25)                                          # needs sage.libs.pari
sage: G.is_distance_regular(True)                                              # needs sage.libs.pari
([125, 120, 1, None], [None, 1, 24, 125])

>>> from sage.all import *
>>> is_from_GQ_spread([Integer(125), Integer(120), Integer(1), Integer(1), Integer(24), Integer(125)])                             # needs sage.libs.pari
(5, 25)
>>> G = graph_from_GQ_spread(Integer(5), Integer(25))                                          # needs sage.libs.pari
>>> G.is_distance_regular(True)                                              # needs sage.libs.pari
([125, 120, 1, None], [None, 1, 24, 125])


REFERENCES:

The graphs we are looking for are antipodal covers of complete graphs. See [BCN1989] pp. 385, 386 for a discussion on these particular case.

sage.graphs.generators.distance_regular.is_near_polygon(array)[source]#

Return a tuple of parameters which identify the near polygon graph with the given intersection array. If such tuple doesn’t exist, return False.

Note that array may be the intersection array of a near polygon, but if such graph has diameter less than 3, then this function will return False.

INPUT:

• array – list; intersection array

OUTPUT:

The tuple has the form (id, params) where id is a value of the enum $$NearPolygonGraph$$ which identify a family of graphs and params are all parameters needed to construct the final graph.

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import (
....: is_near_polygon, near_polygon_graph)
sage: is_near_polygon([7, 6, 6, 5, 5, 4, 1, 1, 2, 2, 3, 3])                     # needs sage.combinat
(2, 7)
sage: near_polygon_graph(2, 7)
Odd Graph with parameter 7: Graph on 1716 vertices
sage: _.is_distance_regular(True)
([7, 6, 6, 5, 5, 4, None], [None, 1, 1, 2, 2, 3, 3])

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import (
... is_near_polygon, near_polygon_graph)
>>> is_near_polygon([Integer(7), Integer(6), Integer(6), Integer(5), Integer(5), Integer(4), Integer(1), Integer(1), Integer(2), Integer(2), Integer(3), Integer(3)])                     # needs sage.combinat
(2, 7)
>>> near_polygon_graph(Integer(2), Integer(7))
Odd Graph with parameter 7: Graph on 1716 vertices
>>> _.is_distance_regular(True)
([7, 6, 6, 5, 5, 4, None], [None, 1, 1, 2, 2, 3, 3])


REFERENCES:

See [BCN1989] pp. 198-206 for some theory about near polygons as well as a list of known examples.

sage.graphs.generators.distance_regular.is_pseudo_partition_graph(arr)[source]#

Return $$(m, a)$$ if the intersection array given satisfies: $$b_i = (m - i)(1 + a(m - 1 - i))$$ for $$0 \leq i < d$$ $$c_i = i(1 + a(i - 1))$$ for $$0 \leq i < d$$ $$c_d = (2d + 2 - m) d (1 + a(d - 1))$$ where $$d$$ is the diameter of the graph.

If such pair $$(m, a)$$ doesn’t exist or the diameter is less than 3, then this function returns False.

These graphs are called pseudo partition graphs in [BCN1989] chapter 6.3.

INPUT:

• arr – list; intersection array

OUTPUT:

A pair $$(m, a)$$ of integers or False if such pair doesn’t exist.

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import *
sage: is_pseudo_partition_graph([36, 25, 16, 1, 4, 18])
(6, 1)
sage: pseudo_partition_graph(6, 1)  # long time
Folded Johnson graph with parameters 12,6: Graph on 462 vertices
sage: _.is_distance_regular(True)  # long time
([36, 25, 16, None], [None, 1, 4, 18])

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import *
>>> is_pseudo_partition_graph([Integer(36), Integer(25), Integer(16), Integer(1), Integer(4), Integer(18)])
(6, 1)
>>> pseudo_partition_graph(Integer(6), Integer(1))  # long time
Folded Johnson graph with parameters 12,6: Graph on 462 vertices
>>> _.is_distance_regular(True)  # long time
([36, 25, 16, None], [None, 1, 4, 18])


REFERENCE:

See [BCN1989] pp. 197, 198 or [VDKT2016] pp. 38, 39.

sage.graphs.generators.distance_regular.locally_GQ42_distance_transitive_graph()[source]#

Return the unique amply regular graph with $$\mu = 6$$ which is locally a generalised quadrangle.

This graph is distance-regular with intersection array $$[45, 32, 12, 1; 1, 6, 32, 45]$$.

This graph is also distance-transitive.

EXAMPLES:

sage: G = graphs.locally_GQ42_distance_transitive_graph()       # optional - internet gap_package_atlasrep
sage: G.is_distance_regular(True)                               # optional - internet gap_package_atlasrep
([45, 32, 12, 1, None], [None, 1, 6, 32, 45])

>>> from sage.all import *
>>> G = graphs.locally_GQ42_distance_transitive_graph()       # optional - internet gap_package_atlasrep
>>> G.is_distance_regular(True)                               # optional - internet gap_package_atlasrep
([45, 32, 12, 1, None], [None, 1, 6, 32, 45])


REFERENCES:

A description of this graph can be found in [BCN1989] p.399. This construction is due to Dima Pasechnik.

sage.graphs.generators.distance_regular.near_polygon_graph(family, params)[source]#

Return the near polygon graph with the given parameters.

The input is expected to be the result of the function sage.graphs.generators.distance_regular.is_near_polygon().

INPUT:

• family – int; an element of the enum NearPolygonGraph.

• params – int or tuple; the parameters needed to construct a graph of the family family.

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import is_near_polygon, near_polygon_graph
sage: near_polygon_graph(*is_near_polygon(                                      # needs sage.combinat
....:     [6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6]))
Bipartite double of Odd graph on a set of 11 elements: Graph on 924 vertices
sage: G=_; G.is_distance_regular(True)                                          # needs sage.combinat
([6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, None],
[None, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6])

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import is_near_polygon, near_polygon_graph
>>> near_polygon_graph(*is_near_polygon(                                      # needs sage.combinat
...     [Integer(6), Integer(5), Integer(5), Integer(4), Integer(4), Integer(3), Integer(3), Integer(2), Integer(2), Integer(1), Integer(1), Integer(1), Integer(1), Integer(2), Integer(2), Integer(3), Integer(3), Integer(4), Integer(4), Integer(5), Integer(5), Integer(6)]))
Bipartite double of Odd graph on a set of 11 elements: Graph on 924 vertices
>>> G=_; G.is_distance_regular(True)                                          # needs sage.combinat
([6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, None],
[None, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6])


REFERENCES:

See [BCN1989] pp. 198-206 for some theory about near polygons as well as a list of known examples.

sage.graphs.generators.distance_regular.pseudo_partition_graph(m, a)[source]#

Return a pseudo partition graph with the given parameters.

A graph is a pseudo partition graph if it is distance-regular with diameter at least 3 and whose intersection numbers satisfy: $$b_i = (m - i)(1 + a(m - 1 - i))$$ for $$0 \leq i < d$$ $$c_i = i(1 + a(i - 1))$$ for $$0 \leq i < d$$ $$c_d = (2d + 2 - m) d (1 + a(d - 1))$$ where $$d$$ is the diameter of the graph.

INPUT:

• m, a – integers; parameters of the graph

EXAMPLES:

sage: from sage.graphs.generators.distance_regular import *
sage: pseudo_partition_graph(6, 1)  # long time
Folded Johnson graph with parameters 12,6: Graph on 462 vertices

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import *
>>> pseudo_partition_graph(Integer(6), Integer(1))  # long time
Folded Johnson graph with parameters 12,6: Graph on 462 vertices


Not all graphs built with this function are pseudo partition graphs as intended by sage.graphs.generators.distance_regular.is_pseudo_partition_graph(), since that function requires the diameter to be at least 3:

sage: from sage.graphs.generators.distance_regular import *
sage: pseudo_partition_graph(3, 1)
Folded Johnson graph with parameters 6,3: Graph on 10 vertices
sage: G=_; G.is_distance_regular(True)
([9, None], [None, 1])
sage: is_pseudo_partition_graph([9, 1])
False

>>> from sage.all import *
>>> from sage.graphs.generators.distance_regular import *
>>> pseudo_partition_graph(Integer(3), Integer(1))
Folded Johnson graph with parameters 6,3: Graph on 10 vertices
>>> G=_; G.is_distance_regular(True)
([9, None], [None, 1])
>>> is_pseudo_partition_graph([Integer(9), Integer(1)])
False


REFERENCES:

See [BCN1989] pp. 197, 198 or [VDKT2016] pp. 38, 39 for a discussion of known pseudo partition graphs.

sage.graphs.generators.distance_regular.shortened_000_111_extended_binary_Golay_code_graph()[source]#

Return a distance-regular graph with intersection array $$[21, 20, 16, 9, 2, 1; 1, 2, 3, 16, 20, 21]$$.

EXAMPLES:

sage: # long time, needs sage.modules sage.rings.finite_rings
sage: G = graphs.shortened_000_111_extended_binary_Golay_code_graph()   # 25 s
sage: G.is_distance_regular(True)
([21, 20, 16, 9, 2, 1, None], [None, 1, 2, 3, 16, 20, 21])

>>> from sage.all import *
>>> # long time, needs sage.modules sage.rings.finite_rings
>>> G = graphs.shortened_000_111_extended_binary_Golay_code_graph()   # 25 s
>>> G.is_distance_regular(True)
([21, 20, 16, 9, 2, 1, None], [None, 1, 2, 3, 16, 20, 21])


ALGORITHM:

Compute the extended binary Golay code. Compute its subcode whose codewords start with 000 or 111. Remove the first 3 entries from all the codewords from the new linear code and compute its coset graph.

REFERENCES:

Description and construction of this graph can be found in [BCN1989] p. 365.

sage.graphs.generators.distance_regular.shortened_00_11_binary_Golay_code_graph()[source]#

Return a distance-regular graph with intersection array $$[21, 20, 16, 6, 2, 1; 1, 2, 6, 16, 20, 21]$$.

EXAMPLES:

sage: # long time, needs sage.modules sage.rings.finite_rings
sage: G = graphs.shortened_00_11_binary_Golay_code_graph()      # 9 s
sage: G.is_distance_regular(True)
([21, 20, 16, 6, 2, 1, None], [None, 1, 2, 6, 16, 20, 21])

>>> from sage.all import *
>>> # long time, needs sage.modules sage.rings.finite_rings
>>> G = graphs.shortened_00_11_binary_Golay_code_graph()      # 9 s
>>> G.is_distance_regular(True)
([21, 20, 16, 6, 2, 1, None], [None, 1, 2, 6, 16, 20, 21])


ALGORITHM:

Compute the binary Golay code. Compute the subcode whose codewords start with 00 or 11. Remove the first two entries from all codewords of the newly found linear code and compute its coset graph.

REFERENCES:

Description and construction of this graph can be found in [BCN1989] p. 365.

sage.graphs.generators.distance_regular.vanLintSchrijverGraph()[source]#

Return the van Lint-Schrijver graph.

The graph is distance-regular with intersection array $$[6, 5, 5, 4; 1, 1, 2, 6]$$.

EXAMPLES:

sage: G = graphs.vanLintSchrijverGraph()                                       # needs sage.modules
sage: G.is_distance_regular(True)                                              # needs sage.modules
([6, 5, 5, 4, None], [None, 1, 1, 2, 6])

>>> from sage.all import *
>>> G = graphs.vanLintSchrijverGraph()                                       # needs sage.modules
>>> G.is_distance_regular(True)                                              # needs sage.modules
([6, 5, 5, 4, None], [None, 1, 1, 2, 6])


REFERENCES:

For a description of this graph see [BCN1989] p. 373.