Skip to content

Commit

Permalink
Trac #30260: Graphs: more distance-regular graphs
Browse files Browse the repository at this point in the history
Added a few more constructions of distance-regular graphs

URL: https://trac.sagemath.org/30260
Reported by: gh-Ivo-Maffei
Ticket author(s): Ivo Maffei
Reviewer(s): Dima Pasechnik
  • Loading branch information
Release Manager committed Aug 13, 2020
2 parents 29098c6 + a87fad1 commit 6f2561f
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 1 deletion.
169 changes: 169 additions & 0 deletions src/sage/graphs/generators/distance_regular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,172 @@ def graph_3O73():
G = Graph(libgap.Orbit(group, [1, 3], libgap.OnSets), format='list_of_edges')
G.name("Distance transitive graph with automorphism group 3.O_7(3)")
return G

def FosterGraph3S6():
r"""
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()
sage: G.is_distance_regular(True)
([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.
"""

a = libgap.eval(("(2,6)(3,5)(4,11)(7,17)(8,16)(9,14)(13,22)(15,25)"
"(18,29)(19,28)(20,21)(24,30)(26,35)(27,33)(31,39)"
"(34,38)(36,43)(37,40)(42,44)"))
b = libgap.eval(("(1,2,7,12,4)(3,8,18,20,10)(5,9,19,21,11)(6,13,17,26,15)"
"(14,23,28,31,24)(16,22,29,36,27)(25,32,35,42,34)"
"(30,37,39,44,38)(33,40,43,45,41)"))

group = libgap.Group(a,b)

G = Graph(group.Orbit([1, 7], libgap.OnSets), format='list_of_edges')
G.name("Foster graph for 3.Sym(6) graph")
return G

def J2Graph():
r"""
Return the distance-transitive graph with automorphism group `J_2`.
EXAMPLES::
sage: G = graphs.J2Graph() # optional - internet gap_packages
sage: G.is_distance_regular(True) # optional - internet gap_packages
([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.
"""
group = libgap.AtlasGroup("J2", libgap.NrMovedPoints, 315)
G = Graph(group.Orbit([1, 9], libgap.OnSets), format='list_of_edges')
G.name("J_2 graph")
return G

def IvanovIvanovFaradjevGraph():
r"""
Return the IvanovIvanovFaradjev graph.
The graph is distance-transitive with automorphism group `3.M_{22}`.
EXAMPLES::
sage: G = graphs.IvanovIvanovFaradjevGraph() # optional - internet gap_packages
sage: G.is_distance_regular(True) # optional - internet gap_packages
([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.
"""

group = libgap.AtlasGroup("3.M22", libgap.NrMovedPoints, 990)
graph = Graph(group.Orbit([1, 22], libgap.OnSets), format='list_of_edges')

graph.name("Ivanov-Ivanov-Faradjev Graph")
return graph

def LargeWittGraph():
r"""
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()
sage: g.is_distance_regular(True)
([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
"""
from sage.coding import codes_catalog as codes
import itertools

C = codes.GolayCode(GF(2), extended=True)
vertices = [c for c in C if c.hamming_weight() == 8]

edges = []
for v, w in itertools.combinations(vertices, 2):
if not set(v.support()).intersection(w.support()):
edges.append((v, w))

W = Graph(edges, format='list_of_edges')
W.name("Large Witt graph")
return W

def TruncatedWittGraph():
r"""
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: G = graphs.TruncatedWittGraph()
sage: 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.
"""
# get large witt graph and remove all vertices which start with a 1
G = LargeWittGraph()
G.delete_vertices(filter(lambda x : x[0] == 1, G.vertices()))

G.name("Truncated Witt graph")
return G

def DoublyTruncatedWittGraph():
r"""
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()
sage: G.is_distance_regular(True)
([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.
"""

G = TruncatedWittGraph()
G.delete_vertices(filter(lambda x : x[1] == 1, G.vertices()))

G.name("Doubly Truncated Witt graph")
return G
14 changes: 13 additions & 1 deletion src/sage/graphs/graph_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def __append_to_doc(methods):
"DesarguesGraph",
"DejterGraph",
"DoubleStarSnark",
"DoublyTruncatedWittGraph",
"DurerGraph",
"DyckGraph",
"EllinghamHorton54Graph",
Expand All @@ -122,6 +123,7 @@ def __append_to_doc(methods):
"FlowerSnark",
"FolkmanGraph",
"FosterGraph",
"FosterGraph3S6",
"FranklinGraph",
"FruchtGraph",
"GoldnerHararyGraph",
Expand All @@ -142,12 +144,15 @@ def __append_to_doc(methods):
"HoltGraph",
"HortonGraph",
"IoninKharaghani765Graph",
"IvanovIvanovFaradjevGraph",
"J2Graph",
"JankoKharaghaniGraph",
"JankoKharaghaniTonchevGraph",
"KittellGraph",
"KrackhardtKiteGraph",
"Klein3RegularGraph",
"Klein7RegularGraph",
"LargeWittGraph",
"locally_GQ42_distance_transitive_graph",
"LocalMcLaughlinGraph",
"LjubljanaGraph",
Expand Down Expand Up @@ -176,6 +181,7 @@ def __append_to_doc(methods):
"TietzeGraph",
"TruncatedIcosidodecahedralGraph",
"TruncatedTetrahedralGraph",
"TruncatedWittGraph",
"Tutte12Cage",
"TutteCoxeterGraph",
"TutteGraph",
Expand Down Expand Up @@ -1938,6 +1944,7 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None
DejterGraph = staticmethod(smallgraphs.DejterGraph)
DesarguesGraph = staticmethod(smallgraphs.DesarguesGraph)
DoubleStarSnark = staticmethod(smallgraphs.DoubleStarSnark)
DoublyTruncatedWittGraph = staticmethod(distance_regular.DoublyTruncatedWittGraph)
DurerGraph = staticmethod(smallgraphs.DurerGraph)
DyckGraph = staticmethod(smallgraphs.DyckGraph)
EllinghamHorton54Graph = staticmethod(smallgraphs.EllinghamHorton54Graph)
Expand All @@ -1947,6 +1954,7 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None
FlowerSnark = staticmethod(smallgraphs.FlowerSnark)
FolkmanGraph = staticmethod(smallgraphs.FolkmanGraph)
FosterGraph = staticmethod(smallgraphs.FosterGraph)
FosterGraph3S6 = staticmethod(distance_regular.FosterGraph3S6)
FranklinGraph = staticmethod(smallgraphs.FranklinGraph)
FruchtGraph = staticmethod(smallgraphs.FruchtGraph)
GoldnerHararyGraph = staticmethod(smallgraphs.GoldnerHararyGraph)
Expand All @@ -1968,12 +1976,15 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None
HoltGraph = staticmethod(smallgraphs.HoltGraph)
HortonGraph = staticmethod(smallgraphs.HortonGraph)
IoninKharaghani765Graph = staticmethod(smallgraphs.IoninKharaghani765Graph)
IvanovIvanovFaradjevGraph = staticmethod(distance_regular.IvanovIvanovFaradjevGraph)
J2Graph = staticmethod(distance_regular.J2Graph)
JankoKharaghaniGraph = staticmethod(smallgraphs.JankoKharaghaniGraph)
JankoKharaghaniTonchevGraph = staticmethod(smallgraphs.JankoKharaghaniTonchevGraph)
KittellGraph = staticmethod(smallgraphs.KittellGraph)
KrackhardtKiteGraph = staticmethod(smallgraphs.KrackhardtKiteGraph)
Klein3RegularGraph = staticmethod(smallgraphs.Klein3RegularGraph)
Klein7RegularGraph = staticmethod(smallgraphs.Klein7RegularGraph)
LargeWittGraph = staticmethod(distance_regular.LargeWittGraph)
locally_GQ42_distance_transitive_graph = staticmethod(distance_regular.locally_GQ42_distance_transitive_graph)
LocalMcLaughlinGraph = staticmethod(smallgraphs.LocalMcLaughlinGraph)
LjubljanaGraph = staticmethod(smallgraphs.LjubljanaGraph)
Expand Down Expand Up @@ -2002,7 +2013,8 @@ def quadrangulations(self, order, minimum_degree=None, minimum_connectivity=None
TietzeGraph = staticmethod(smallgraphs.TietzeGraph)
Tutte12Cage = staticmethod(smallgraphs.Tutte12Cage)
TruncatedIcosidodecahedralGraph = staticmethod(smallgraphs.TruncatedIcosidodecahedralGraph)
TruncatedTetrahedralGraph= staticmethod(smallgraphs.TruncatedTetrahedralGraph)
TruncatedTetrahedralGraph = staticmethod(smallgraphs.TruncatedTetrahedralGraph)
TruncatedWittGraph = staticmethod(distance_regular.TruncatedWittGraph)
TutteCoxeterGraph = staticmethod(smallgraphs.TutteCoxeterGraph)
TutteGraph = staticmethod(smallgraphs.TutteGraph)
U42Graph216 = staticmethod(smallgraphs.U42Graph216)
Expand Down

0 comments on commit 6f2561f

Please sign in to comment.