Ticket #10329: trac-10329_goldner-harary.patch

File trac-10329_goldner-harary.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 1290706209 28800
    # Node ID c8e2da57206307549bd8b2eb4b2978ab376e3767
    # Parent  e975f3c1e10421ca653434343f7cf71b9d823edb
    #10329: add Goldner-Harary graph to common graphs database
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    104104- :meth:`FlowerSnark <GraphGenerators.FlowerSnark>`
    105105- :meth:`FranklinGraph <GraphGenerators.FranklinGraph>`
    106106- :meth:`FruchtGraph <GraphGenerators.FruchtGraph>`
     107- :meth:`GoldnerHararyGraph <GraphGenerators.GoldnerHararyGraph>`
    107108- :meth:`GrotzschGraph <GraphGenerators.GrotzschGraph>`
    108109- :meth:`HeawoodGraph <GraphGenerators.HeawoodGraph>`
    109110- :meth:`HigmanSimsGraph <GraphGenerators.HigmanSimsGraph>`
     
    26472648        G = networkx.frucht_graph()
    26482649        return graph.Graph(G, pos=pos_dict, name="Frucht graph")
    26492650
     2651    def GoldnerHararyGraph(self):
     2652        r"""
     2653        Return the Goldner-Harary graph.
     2654
     2655        For more information, see this
     2656        `Wikipedia article on the Goldner-Harary graph <http://en.wikipedia.org/wiki/Goldner%E2%80%93Harary_graph>`_.
     2657
     2658        EXAMPLES:
     2659
     2660        The Goldner-Harary graph is named after A. Goldner and Frank Harary.
     2661        It is a planar graph having 11 vertices and 27 edges. ::
     2662
     2663            sage: G = graphs.GoldnerHararyGraph(); G
     2664            Goldner-Harary graph: Graph on 11 vertices
     2665            sage: G.is_planar()
     2666            True
     2667            sage: G.order()
     2668            11
     2669            sage: G.size()
     2670            27
     2671
     2672        The Goldner-Harary graph is chordal with radius 2, diameter 2, and
     2673        girth 3. ::
     2674
     2675            sage: G.is_chordal()
     2676            True
     2677            sage: G.radius()
     2678            2
     2679            sage: G.diameter()
     2680            2
     2681            sage: G.girth()
     2682            3
     2683
     2684        Its chromatic number is 4 and its automorphism group is isomorphic to
     2685        the dihedral group `D_6`. ::
     2686
     2687            sage: G.chromatic_number()
     2688            4
     2689            sage: ag = G.automorphism_group()
     2690            sage: ag.is_isomorphic(DihedralGroup(6))
     2691            True
     2692        """
     2693        edge_dict = {
     2694            0: [1,3,4],
     2695            1: [2,3,4,5,6,7,10],
     2696            2: [3,7],
     2697            3: [7,8,9,10],
     2698            4: [3,5,9,10],
     2699            5: [10],
     2700            6: [7,10],
     2701            7: [8,10],
     2702            8: [10],
     2703            9: [10]}
     2704        return graph.Graph(edge_dict, name="Goldner-Harary graph")
     2705
    26502706    def GrotzschGraph(self):
    26512707        r"""
    26522708        Creates the Grotzsch graph.