Ticket #10321: trac-10321_errera-graph.patch

File trac-10321_errera-graph.patch, 3.0 KB (added by mvngu, 11 years ago)
  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Minh Van Nguyen <nguyenminh2@gmail.com>
    # Date 1290624925 28800
    # Node ID 660b96851fa082b50c9906980a47abac33747b9f
    # Parent  242de3e5f6f6e86db4ca585f75404b64fa1a7783
    #10321: add Errera graph to common graph database
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    100100- :meth:`ChvatalGraph <GraphGenerators.ChvatalGraph>`
    101101- :meth:`DesarguesGraph <GraphGenerators.DesarguesGraph>`
    102102- :meth:`DurerGraph <GraphGenerators.DurerGraph>`
     103- :meth:`ErreraGraph <GraphGenerators.ErreraGraph>`
    103104- :meth:`FlowerSnark <GraphGenerators.FlowerSnark>`
    104105- :meth:`FruchtGraph <GraphGenerators.FruchtGraph>`
    105106- :meth:`GrotzschGraph <GraphGenerators.GrotzschGraph>`
     
    24182419            10: [-0.5, -0.866025403784439],
    24192420            11: [0.5, -0.866025403784439]}
    24202421        return graph.Graph(edge_dict, pos=pos_dict, name="Durer graph")
     2422
     2423    def ErreraGraph(self):
     2424        r"""
     2425        Returns the Errera graph.
     2426
     2427        For more information, see this
     2428        `Wikipedia article on the Errera graph <http://en.wikipedia.org/wiki/Errera_graph>`_.
     2429
     2430        EXAMPLES:
     2431
     2432        The Errera graph is named after Alfred Errera. It is a planar graph
     2433        on 17 vertices and having 45 edges. ::
     2434
     2435            sage: G = graphs.ErreraGraph(); G
     2436            Errera graph: Graph on 17 vertices
     2437            sage: G.is_planar()
     2438            True
     2439            sage: G.order()
     2440            17
     2441            sage: G.size()
     2442            45
     2443
     2444        The Errera graph is Hamiltonian with radius 3, diameter 4, girth 3,
     2445        and chromatic number 4. ::
     2446
     2447            sage: G.is_hamiltonian()
     2448            True
     2449            sage: G.radius()
     2450            3
     2451            sage: G.diameter()
     2452            4
     2453            sage: G.girth()
     2454            3
     2455            sage: G.chromatic_number()
     2456            4
     2457
     2458        Each vertex degree is either 5 or 6. That is, if `f` counts the
     2459        number of vertices of degree 5 and `s` counts the number of vertices
     2460        of degree 6, then `f + s` is equal to the order of the Errera
     2461        graph. ::
     2462
     2463            sage: D = G.degree_sequence()
     2464            sage: D.count(5) + D.count(6) == G.order()
     2465            True
     2466
     2467        The automorphism group of the Errera graph is isomorphic to the
     2468        dihedral group of order 20. ::
     2469
     2470            sage: ag = G.automorphism_group()
     2471            sage: ag.is_isomorphic(DihedralGroup(10))
     2472            True
     2473        """
     2474        edge_dict = {
     2475            0: [1,7,14,15,16],
     2476            1: [2,9,14,15],
     2477            2: [3,8,9,10,14],
     2478            3: [4,9,10,11],
     2479            4: [5,10,11,12],
     2480            5: [6,11,12,13],
     2481            6: [7,8,12,13,16],
     2482            7: [13,15,16],
     2483            8: [10,12,14,16],
     2484            9: [11,13,15],
     2485            10: [12],
     2486            11: [13],
     2487            13: [15],
     2488            14: [16]}
     2489        return graph.Graph(edge_dict, name="Errera graph")
    24212490   
    24222491    def FlowerSnark(self):
    24232492        """