# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1367943668 -7200
# Node ID 49e045b4830bb9fe7a6a414c5020ec1b3c7cfc6b
# Parent 43d1c29f68cd3f5d88cc558b73fade47e2ec732f
A constructor for the McLaughlin graph
diff --git a/sage/graphs/generators/smallgraphs.py b/sage/graphs/generators/smallgraphs.py
a
|
b
|
|
2756 | 2756 | else: |
2757 | 2757 | raise ValueError("The value of embedding must be 1 or 2.") |
2758 | 2758 | |
| 2759 | def McLaughlinGraph(): |
| 2760 | r""" |
| 2761 | Returns the McLaughlin Graph. |
| 2762 | |
| 2763 | The McLaughlin Graph is the unique strongly regular graph of parameters |
| 2764 | `(275, 112, 30, 56)`. |
| 2765 | |
| 2766 | For more information on the McLaughlin Graph, see its web page on `Andries |
| 2767 | Brouwer's website <http://www.win.tue.nl/~aeb/graphs/McL.html>`_ which gives |
| 2768 | the definition that this method implements. |
| 2769 | |
| 2770 | .. NOTE:: |
| 2771 | |
| 2772 | To create this graph you must have the gap_packages spkg installed. |
| 2773 | |
| 2774 | EXAMPLES:: |
| 2775 | |
| 2776 | sage: g = graphs.McLaughlinGraph() # optional gap_packages |
| 2777 | sage: g.is_strongly_regular(parameters=True) # optional gap_packages |
| 2778 | (275, 112, 30, 56) |
| 2779 | sage: set(g.spectrum()) == {112, 2, -28} # optional gap_packages |
| 2780 | True |
| 2781 | """ |
| 2782 | from sage.combinat.designs.block_design import WittDesign |
| 2783 | from itertools import combinations |
| 2784 | from sage.sets.set import Set |
| 2785 | |
| 2786 | blocks = WittDesign(23).blocks() |
| 2787 | blocks = map(Set,blocks) |
| 2788 | B = [b for b in blocks if 0 in b] |
| 2789 | C = [b for b in blocks if not 0 in b] |
| 2790 | g = graph.Graph() |
| 2791 | for b in B: |
| 2792 | for x in range(23): |
| 2793 | if not x in b: |
| 2794 | g.add_edge(b,x) |
| 2795 | |
| 2796 | for b in C: |
| 2797 | for x in b: |
| 2798 | g.add_edge(b,x) |
| 2799 | |
| 2800 | for b,bb in combinations(B,2): |
| 2801 | if len(b&bb) == 1: |
| 2802 | g.add_edge(b,bb) |
| 2803 | |
| 2804 | for c,cc in combinations(C,2): |
| 2805 | if len(c&cc) == 1: |
| 2806 | g.add_edge(c,cc) |
| 2807 | |
| 2808 | for b in B: |
| 2809 | for c in C: |
| 2810 | if len(b&c) == 3: |
| 2811 | g.add_edge(b,c) |
| 2812 | |
| 2813 | g.relabel() |
| 2814 | g.name("McLaughlin") |
| 2815 | return g |
| 2816 | |
2759 | 2817 | def MoebiusKantorGraph(): |
2760 | 2818 | """ |
2761 | 2819 | Returns a Moebius-Kantor Graph. |
diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
a
|
b
|
|
127 | 127 | "HoltGraph", |
128 | 128 | "LjubljanaGraph", |
129 | 129 | "McGeeGraph", |
| 130 | "McLaughlinGraph", |
130 | 131 | "M22Graph", |
131 | 132 | "MoebiusKantorGraph", |
132 | 133 | "MoserSpindle", |
… |
… |
|
991 | 992 | HoltGraph = staticmethod(sage.graphs.generators.smallgraphs.HoltGraph) |
992 | 993 | LjubljanaGraph = staticmethod(sage.graphs.generators.smallgraphs.LjubljanaGraph) |
993 | 994 | McGeeGraph = staticmethod(sage.graphs.generators.smallgraphs.McGeeGraph) |
| 995 | McLaughlinGraph = staticmethod(sage.graphs.generators.smallgraphs.McLaughlinGraph) |
994 | 996 | M22Graph = staticmethod(sage.graphs.generators.smallgraphs.M22Graph) |
995 | 997 | MoebiusKantorGraph = staticmethod(sage.graphs.generators.smallgraphs.MoebiusKantorGraph) |
996 | 998 | MoserSpindle = staticmethod(sage.graphs.generators.smallgraphs.MoserSpindle) |