Ticket #10322: trac-10322_franklin-graph.patch

File trac-10322_franklin-graph.patch, 3.0 KB (added by mvngu, 12 years ago)
  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Minh Van Nguyen <nguyenminh2@gmail.com>
    # Date 1290628216 28800
    # Node ID e975f3c1e10421ca653434343f7cf71b9d823edb
    # Parent  660b96851fa082b50c9906980a47abac33747b9f
    #10322: add Franklin graph to common graphs database
    
    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    102102- :meth:`DurerGraph <GraphGenerators.DurerGraph>`
    103103- :meth:`ErreraGraph <GraphGenerators.ErreraGraph>`
    104104- :meth:`FlowerSnark <GraphGenerators.FlowerSnark>`
     105- :meth:`FranklinGraph <GraphGenerators.FranklinGraph>`
    105106- :meth:`FruchtGraph <GraphGenerators.FruchtGraph>`
    106107- :meth:`GrotzschGraph <GraphGenerators.GrotzschGraph>`
    107108- :meth:`HeawoodGraph <GraphGenerators.HeawoodGraph>`
     
    25332534                            12:[13,19],13:[14],15:[19],16:[15,17],18:[17,19]}, \
    25342535                            pos=pos_dict, name="Flower Snark")
    25352536
     2537    def FranklinGraph(self):
     2538        r"""
     2539        Returns the Franklin graph.
     2540
     2541        For more information, see this
     2542        `Wikipedia article on the Franklin graph <http://en.wikipedia.org/wiki/Franklin_graph>`_.
     2543
     2544        EXAMPLES:
     2545
     2546        The Franklin graph is named after Philip Franklin. It is a
     2547        3-regular graph on 12 vertices and having 18 edges. ::
     2548
     2549            sage: G = graphs.FranklinGraph(); G
     2550            Franklin graph: Graph on 12 vertices
     2551            sage: G.is_regular(3)
     2552            True
     2553            sage: G.order()
     2554            12
     2555            sage: G.size()
     2556            18
     2557
     2558        The Franklin graph is a Hamiltonian, bipartite graph with radius 3,
     2559        diameter 3, and girth 4. ::
     2560
     2561            sage: G.is_hamiltonian()
     2562            True
     2563            sage: G.is_bipartite()
     2564            True
     2565            sage: G.radius()
     2566            3
     2567            sage: G.diameter()
     2568            3
     2569            sage: G.girth()
     2570            4
     2571
     2572        It is a perfect, triangle-free graph having chromatic number 2. ::
     2573
     2574            sage: G.is_perfect()
     2575            True
     2576            sage: G.is_triangle_free()
     2577            True
     2578            sage: G.chromatic_number()
     2579            2
     2580        """
     2581        edge_dict = {
     2582            0: [1,5,6],
     2583            1: [2,7],
     2584            2: [3,8],
     2585            3: [4,9],
     2586            4: [5,10],
     2587            5: [11],
     2588            6: [7,9],
     2589            7: [10],
     2590            8: [9,11],
     2591            10: [11]}
     2592        pos_dict = {
     2593            0: [2, 0],
     2594            1: [1, 1.73205080756888],
     2595            2: [-1, 1.73205080756888],
     2596            3: [-2, 0],
     2597            4: [-1, -1.73205080756888],
     2598            5: [1, -1.73205080756888],
     2599            6: [1, 0],
     2600            7: [0.5, 0.866025403784439],
     2601            8: [-0.5, 0.866025403784439],
     2602            9: [-1, 0],
     2603            10: [-0.5, -0.866025403784439],
     2604            11: [0.5, -0.866025403784439]}
     2605        return graph.Graph(edge_dict, pos=pos_dict, name="Franklin graph")
     2606
    25362607    def FruchtGraph(self):
    25372608        """
    25382609        Returns a Frucht Graph.