diff --git a/src/sage/graphs/generators/distance_regular.pyx b/src/sage/graphs/generators/distance_regular.pyx index 71f641defe4..7cc53a9be04 100644 --- a/src/sage/graphs/generators/distance_regular.pyx +++ b/src/sage/graphs/generators/distance_regular.pyx @@ -399,7 +399,10 @@ def LargeWittGraph(): The construction is taken from http://mathworld.wolfram.com/LargeWittGraph.html - EXAMPLES: + 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) @@ -419,3 +422,50 @@ def LargeWittGraph(): 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]) + + """ + # 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]) + """ + + G = TruncatedWittGraph() + G.delete_vertices(filter(lambda x : x[1] == 1, G.vertices())) + + G.name("Doubly Truncated Witt graph") + return G diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 119d5d8f535..44152f1e773 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -110,6 +110,7 @@ def __append_to_doc(methods): "DesarguesGraph", "DejterGraph", "DoubleStarSnark", + "DoublyTruncatedWittGraph", "DurerGraph", "DyckGraph", "EllinghamHorton54Graph", @@ -177,6 +178,7 @@ def __append_to_doc(methods): "TietzeGraph", "TruncatedIcosidodecahedralGraph", "TruncatedTetrahedralGraph", + "TruncatedWittGraph", "Tutte12Cage", "TutteCoxeterGraph", "TutteGraph", @@ -1937,6 +1939,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) @@ -2005,7 +2008,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)