Ticket #10316: trac-10316_durer-graph.patch

File trac-10316_durer-graph.patch, 2.6 KB (added by mvngu, 11 years ago)
  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Minh Van Nguyen <nguyenminh2@gmail.com>
    # Date 1290547935 28800
    # Node ID 562e54d365376e34e60bda625cd2b1b88f26fafc
    # Parent  f323375be0397a7c503a3332666c559abd9381dc
    #10316: add Durer graph to common graph database
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
     1# -*- coding: utf-8 -*-
     2
    13r"""
    24Common graphs
    35
     
    9799- :meth:`BrinkmannGraph <GraphGenerators.BrinkmannGraph>`
    98100- :meth:`ChvatalGraph <GraphGenerators.ChvatalGraph>`
    99101- :meth:`DesarguesGraph <GraphGenerators.DesarguesGraph>`
     102- :meth:`DurerGraph <GraphGenerators.DurerGraph>`
    100103- :meth:`FlowerSnark <GraphGenerators.FlowerSnark>`
    101104- :meth:`FruchtGraph <GraphGenerators.FruchtGraph>`
    102105- :meth:`GrotzschGraph <GraphGenerators.GrotzschGraph>`
     
    23532356        G=graphs.GeneralizedPetersenGraph(10,3)
    23542357        G.name("Desargues Graph")
    23552358        return G
     2359
     2360    def DurerGraph(self):
     2361        r"""
     2362        Returns the Dürer graph.
     2363
     2364        For more information, see this
     2365        `Wikipedia article on the Dürer graph <http://en.wikipedia.org/wiki/D%C3%BCrer_graph>`_.
     2366
     2367        EXAMPLES:
     2368
     2369        The Dürer graph is named after Albrecht Dürer. It is a planar graph
     2370        with 12 vertices and 18 edges. ::
     2371
     2372            sage: G = graphs.DurerGraph(); G
     2373            Durer graph: Graph on 12 vertices
     2374            sage: G.is_planar()
     2375            True
     2376            sage: G.order()
     2377            12
     2378            sage: G.size()
     2379            18
     2380
     2381        The Dürer graph has chromatic number 3, diameter 4, and girth 3. ::
     2382
     2383            sage: G.chromatic_number()
     2384            3
     2385            sage: G.diameter()
     2386            4
     2387            sage: G.girth()
     2388            3
     2389        """
     2390        edge_dict = {
     2391            0: [1,5,6],
     2392            1: [2,7],
     2393            2: [3,8],
     2394            3: [4,9],
     2395            4: [5,10],
     2396            5: [11],
     2397            6: [8,10],
     2398            7: [9,11],
     2399            8: [10],
     2400            9: [11]}
     2401        pos_dict = {
     2402            0: [2, 0],
     2403            1: [1, 1.73205080756888],
     2404            2: [-1, 1.73205080756888],
     2405            3: [-2, 0],
     2406            4: [-1, -1.73205080756888],
     2407            5: [1, -1.73205080756888],
     2408            6: [1, 0],
     2409            7: [0.5, 0.866025403784439],
     2410            8: [-0.5, 0.866025403784439],
     2411            9: [-1, 0],
     2412            10: [-0.5, -0.866025403784439],
     2413            11: [0.5, -0.866025403784439]}
     2414        return graph.Graph(edge_dict, pos=pos_dict, name="Durer graph")
    23562415   
    23572416    def FlowerSnark(self):
    23582417        """