Ticket #14514: trac_14514.patch

File trac_14514.patch, 3.4 KB (added by ncohen, 6 years ago)
  • sage/graphs/generators/smallgraphs.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1367413398 -7200
    # Node ID 37d8fe0d4d8cfdf5f810b8d0683034ad34bcfbe9
    # Parent  ba72e523315fa1164935c96f8fd72e6f0c7c3de6
    A constructor for the Brouwer-Haemers graph
    
    diff --git a/sage/graphs/generators/smallgraphs.py b/sage/graphs/generators/smallgraphs.py
    a b  
    10411041        20: [-0.433883739117558, 0.900968867902419]}
    10421042    return graph.Graph(edge_dict, pos=pos_dict, name="Brinkmann graph")
    10431043
     1044def BrouwerHaemersGraph():
     1045    r"""
     1046    Returns the Brouwer-Haemers Graph.
     1047
     1048    The Brouwer-Haemers is the only strongly regular graph of parameters
     1049    `(81,20,1,6)`. It is build in Sage as the Affine Orthogonal graph
     1050    `VO^-(6,3)`. For more information on this graph, see its `corresponding page
     1051    on Andries Brouwer's website
     1052    <http://www.win.tue.nl/~aeb/graphs/Brouwer-Haemers.html>`_.
     1053
     1054    EXAMPLE::
     1055
     1056        sage: g = graphs.BrouwerHaemersGraph()
     1057        sage: g
     1058        Brouwer-Haemers: Graph on 81 vertices
     1059
     1060    It is indeed strongly regular with parameters `(81,20,1,6)`::
     1061
     1062        sage: g.is_strongly_regular(parameters = True) # long time
     1063        (81, 20, 1, 6)
     1064
     1065    Its has as eigenvalues `20,2` and `-7`::
     1066
     1067        sage: set(g.spectrum()) == {20,2,-7}
     1068        True
     1069    """
     1070    from sage.rings.finite_rings.constructor import FiniteField
     1071    from sage.modules.free_module import VectorSpace
     1072    from sage.matrix.constructor import Matrix
     1073    from sage.matrix.constructor import identity_matrix
     1074
     1075    d = 4
     1076    q = 3
     1077    F = FiniteField(q,"x")
     1078    V = VectorSpace(F,d)
     1079    M = Matrix(F,identity_matrix(d))
     1080    M[1,1]=-1
     1081    G = Graph([map(tuple,V), lambda x,y:(V(x)-V(y))*(M*(V(x)-V(y))) == 0], loops = False)
     1082    G.relabel()
     1083    ordering = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
     1084                18, 19, 20, 21, 22, 23, 24, 25, 26, 48, 49, 50, 51, 52, 53,
     1085                45, 46, 47, 30, 31, 32, 33, 34, 35, 27, 28, 29, 39, 40, 41,
     1086                42, 43, 44, 36, 37, 38, 69, 70, 71, 63, 64, 65, 66, 67, 68,
     1087                78, 79, 80, 72, 73, 74, 75, 76, 77, 60, 61, 62, 54, 55, 56,
     1088                57, 58, 59]
     1089    _circle_embedding(G, ordering)
     1090    G.name("Brouwer-Haemers")
     1091    return G
     1092
    10441093def DoubleStarSnark():
    10451094    r"""
    10461095    Returns the double star snark.
  • 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     "BrouwerHaemersGraph",
    9899     "CameronGraph",
    99100     "ChvatalGraph",
    100101     "ClebschGraph",
     
    959960    BidiakisCube             = staticmethod(sage.graphs.generators.smallgraphs.BidiakisCube)
    960961    BiggsSmithGraph          = staticmethod(sage.graphs.generators.smallgraphs.BiggsSmithGraph)
    961962    BrinkmannGraph           = staticmethod(sage.graphs.generators.smallgraphs.BrinkmannGraph)
     963    BrouwerHaemersGraph      = staticmethod(sage.graphs.generators.smallgraphs.BrouwerHaemersGraph)
    962964    CameronGraph             = staticmethod(sage.graphs.generators.smallgraphs.CameronGraph)
    963965    ChvatalGraph             = staticmethod(sage.graphs.generators.smallgraphs.ChvatalGraph)
    964966    ClebschGraph             = staticmethod(sage.graphs.generators.smallgraphs.ClebschGraph)