Ticket #14283: trac_14283.patch

File trac_14283.patch, 5.9 KB (added by ncohen, 8 years ago)
  • sage/graphs/generators/smallgraphs.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1363453664 -3600
    # Node ID c5a06602b3a19a7c6781633c313b1ac5c6b6e94c
    # Parent  5a8b0a4abed2e72ceb675375030d13203cf12354
    M22 and Cameron Graph constructors
    
    diff --git a/sage/graphs/generators/smallgraphs.py b/sage/graphs/generators/smallgraphs.py
    a b  
    11031103
    11041104    return g
    11051105
     1106def CameronGraph():
     1107    r"""
     1108    Returns the Cameron graph.
     1109
     1110    The Cameron graph is strongly regular with parameters `v = 231, k = 30,
     1111    \lambda = 9, \mu = 3`.
     1112
     1113    For more information on the Cameron graph, see
     1114    `<http://www.win.tue.nl/~aeb/graphs/Cameron.html>`_.
     1115
     1116    EXAMPLES::
     1117
     1118        sage: g = graphs.CameronGraph()
     1119        sage: g.order()
     1120        231
     1121        sage: g.size()
     1122        3465
     1123        sage: g.is_strongly_regular(parameters = True) # long time
     1124        (231, 30, 9, 3)
     1125
     1126    """
     1127    from sage.groups.perm_gps.permgroup_named import MathieuGroup
     1128    from itertools import combinations
     1129    g = Graph(name="Cameron Graph")
     1130    sets = MathieuGroup(22).orbit((1,2,3,7,10,20), action = "OnSets")
     1131    for s in sets:
     1132        for a,b,c,d in combinations(s,4):
     1133            g.add_edges([((a,b),(c,d)),((a,c),(b,d)), ((a,d),(b,c))])
     1134
     1135    g.relabel()
     1136    ordering = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18, 19, 20,
     1137                21, 24, 25, 26, 27, 29, 31, 34, 35, 38, 39, 96, 97, 101, 105,
     1138                51, 117, 198, 32, 196, 201, 131, 167, 199, 197, 86, 102, 195,
     1139                200, 186, 144, 202, 177, 44, 53, 58, 45, 48, 54, 43, 57, 50,
     1140                46, 59, 133, 169, 104, 188, 118, 208, 157, 52, 207, 209, 132,
     1141                204, 13, 187, 33, 203, 70, 145, 103, 168, 178, 87, 124, 123,
     1142                125, 111, 120, 116, 119, 112, 95, 114, 115, 137, 218, 213, 108,
     1143                76, 77, 74, 62, 64, 67, 63, 68, 69, 61, 41, 75, 73, 66, 71, 72,
     1144                60, 22, 230, 151, 184, 138, 193, 109, 228, 174, 214, 219, 93,
     1145                126, 143, 150, 146, 224, 181, 16, 223, 171, 90, 135, 106, 205,
     1146                211, 121, 148, 160, 216, 222, 190, 36, 55, 185, 175, 94, 139,
     1147                110, 215, 152, 220, 229, 194, 40, 128, 99, 141, 173, 154, 82,
     1148                156, 164, 159, 28, 127, 158, 65, 162, 163, 153, 161, 155, 140,
     1149                98, 47, 113, 84, 180, 30, 129, 179, 183, 165, 176, 142, 100,
     1150                49, 134, 210, 170, 147, 91, 37, 206, 182, 191, 56, 136, 225,
     1151                221, 149, 227, 217, 17, 107, 172, 212, 122, 226, 23, 85, 42,
     1152                80, 92, 81, 89, 78, 83, 88, 79, 130, 192, 189, 166]
     1153
     1154    _circle_embedding(g, ordering)
     1155    return g
     1156
    11061157def ChvatalGraph():
    11071158    r"""
    11081159    Returns the Chvatal graph.
     
    25612612    else:
    25622613        raise ValueError("The value of embedding must be 1 or 2.")
    25632614
     2615def M22Graph():
     2616    r"""
     2617    Returns the M22 graph.
     2618
     2619    The `M_{22}` graph is the unique strongly regular graph with parameters
     2620    `v = 77, k = 16, \lambda = 0, \mu = 4`.
     2621
     2622    For more information on the `M_{22}` graph, see
     2623    `<http://www.win.tue.nl/~aeb/graphs/M22.html>`_.
     2624
     2625    EXAMPLES::
     2626
     2627        sage: g = graphs.M22Graph()
     2628        sage: g.order()
     2629        77
     2630        sage: g.size()
     2631        616
     2632        sage: g.is_strongly_regular(parameters = True)
     2633        (77, 16, 0, 4)
     2634    """
     2635    from sage.groups.perm_gps.permgroup_named import MathieuGroup
     2636    sets = map(tuple,MathieuGroup(22).orbit((1,2,3,7,10,20), action = "OnSets"))
     2637    g = Graph([sets, lambda x,y : not any(xx in y for xx in x)], name="M22 Graph")
     2638    g.relabel()
     2639    ordering = [0, 1, 3, 4, 5, 6, 7, 10, 12, 19, 20, 31, 2, 24, 35, 34, 22, 32,
     2640                36, 23, 27, 25, 40, 26, 16, 71, 61, 63, 50, 68, 39, 52, 48, 44,
     2641                69, 28, 9, 64, 60, 17, 38, 49, 45, 65, 14, 70, 72, 21, 43, 56,
     2642                33, 73, 58, 55, 41, 29, 66, 54, 76, 46, 67, 11, 51, 47, 62, 53,
     2643                15, 8, 18, 13, 59, 37, 30, 57, 75, 74, 42]
     2644
     2645    _circle_embedding(g, ordering)
     2646
     2647    return g
     2648
    25642649def McGeeGraph(embedding=2):
    25652650    r"""
    25662651    Returns the McGee Graph.
  • sage/graphs/graph_generators.py

    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    9595     "BidiakisCube",
    9696     "BiggsSmithGraph",
    9797     "BrinkmannGraph",
     98     "CameronGraph",
    9899     "ChvatalGraph",
    99100     "ClebschGraph",
    100101     "CoxeterGraph",
     
    125126     "HoltGraph",
    126127     "LjubljanaGraph",
    127128     "McGeeGraph",
     129     "M22Graph",
    128130     "MoebiusKantorGraph",
    129131     "MoserSpindle",
    130132     "NauruGraph",
     
    957959    BidiakisCube             = staticmethod(sage.graphs.generators.smallgraphs.BidiakisCube)
    958960    BiggsSmithGraph          = staticmethod(sage.graphs.generators.smallgraphs.BiggsSmithGraph)
    959961    BrinkmannGraph           = staticmethod(sage.graphs.generators.smallgraphs.BrinkmannGraph)
     962    CameronGraph             = staticmethod(sage.graphs.generators.smallgraphs.CameronGraph)
    960963    ChvatalGraph             = staticmethod(sage.graphs.generators.smallgraphs.ChvatalGraph)
    961964    ClebschGraph             = staticmethod(sage.graphs.generators.smallgraphs.ClebschGraph)
    962965    CoxeterGraph             = staticmethod(sage.graphs.generators.smallgraphs.CoxeterGraph)
     
    986989    HoltGraph                = staticmethod(sage.graphs.generators.smallgraphs.HoltGraph)
    987990    LjubljanaGraph           = staticmethod(sage.graphs.generators.smallgraphs.LjubljanaGraph)
    988991    McGeeGraph               = staticmethod(sage.graphs.generators.smallgraphs.McGeeGraph)
     992    M22Graph                 = staticmethod(sage.graphs.generators.smallgraphs.M22Graph)
    989993    MoebiusKantorGraph       = staticmethod(sage.graphs.generators.smallgraphs.MoebiusKantorGraph)
    990994    MoserSpindle             = staticmethod(sage.graphs.generators.smallgraphs.MoserSpindle)
    991995    NauruGraph               = staticmethod(sage.graphs.generators.smallgraphs.NauruGraph)