Ticket #6813: 6813-worldmap.patch

File 6813-worldmap.patch, 2.4 KB (added by awebb, 10 years ago)

applies to sage-4.1.2.rc0

  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1251016915 -7200
    # Node ID e84009a8522621af07009435934aa4435428e03e
    # Parent  5398e0ca857cda43508e4c1d2f6ff92724b35c32
    Trac # 6813 :Function WorldMap
    
    diff -r 5398e0ca857c -r e84009a85226 sage/graphs/graph_generators.py
    a b  
    109109        - DegreeSequenceConfigurationModel
    110110        - DegreeSequenceTree
    111111        - DegreeSequenceExpected
     112    Oddities :
     113        - WorldMap
    112114       
    113115
    114116AUTHORS:
     
    133135
    134136- Robert Miller (2007-10-24): Isomorph free exhaustive generation
    135137
     138- Nathann Cohen (2009-08-12): WorldMap
     139
    136140- Michael Yurko (2009-9-01): added hyperstar, (n,k)-star, n-star, and
    137141  bubblesort graphs
    138142"""
     
    227231                    - DegreeSequenceConfigurationModel
    228232                    - DegreeSequenceTree
    229233                    - DegreeSequenceExpected
    230            
     234                Oddities :
     235                    - WorldMap           
    231236   
    232237    ORDERLY GENERATION: graphs(vertices, property=lambda x: True,
    233238    augment='edges', size=None)
     
    31673172        import networkx
    31683173        return graph.Graph(networkx.random_shell_graph(constructor, seed))
    31693174
     3175    def WorldMap(self):
     3176        """
     3177        Returns the Graph of all the countries, in which two countries are adjacent
     3178        in the graph if they have a common boundary.
     3179
     3180        This graph has been built from the data available
     3181        in The CIA World Factbook [1] (2009-08-21).
     3182
     3183        The returned graph ``G`` has a member ``G.gps_coordinates``
     3184        equal to a dictionary containing the GPS coordinates
     3185        of each country's capital city.
     3186
     3187        EXAMPLE::
     3188       
     3189            sage: g=graphs.WorldMap()
     3190            sage: g.has_edge("France","Italy")
     3191            True
     3192       
     3193        REFERENCE:
     3194       
     3195        .. [1] CIA Factbook 09 https://www.cia.gov/library/publications/the-world-factbook/
     3196        """
     3197
     3198        from sage.structure.sage_object import load
     3199        from sage.misc.misc import SAGE_DATA
     3200        return load(SAGE_DATA+"graphs/graph_world.sobj")
     3201
    31703202################################################################################
    31713203#   Graphs with a given degree sequence
    31723204################################################################################