Ticket #6813: worldmap.patch

File worldmap.patch, 2.5 KB (added by ncohen, 10 years ago)
  • sage/graphs/graph_generators.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1251016915 -7200
    # Node ID e35526b63ba257dce464870102dcb962057829d2
    # Parent  684eea91ff224e5bc6259ca19f1576c4c082b9d3
    Function WorldMap
    
    diff -r 684eea91ff22 -r e35526b63ba2 sage/graphs/graph_generators.py
    a b  
    105105        - DegreeSequenceConfigurationModel
    106106        - DegreeSequenceTree
    107107        - DegreeSequenceExpected
     108    Oddities :
     109        - WorldMap
    108110       
    109111
    110112AUTHORS:
     
    128130  graphs with a given degree sequence, random directed graphs
    129131
    130132- Robert Miller (2007-10-24): Isomorph free exhaustive generation
     133
     134- Nathann Cohen (2009-08-12): WorldMap
    131135"""
    132136
    133137################################################################################
     
    219223                    - DegreeSequenceConfigurationModel
    220224                    - DegreeSequenceTree
    221225                    - DegreeSequenceExpected
    222            
     226                Oddities :
     227                    - WorldMap           
    223228   
    224229    ORDERLY GENERATION: graphs(vertices, property=lambda x: True,
    225230    augment='edges', size=None)
     
    29532958        import networkx
    29542959        return graph.Graph(networkx.random_shell_graph(constructor, seed))
    29552960
     2961    def WorldMap(self):
     2962        """
     2963        Returns the Graph of all the countries, in which two countries are adjacent
     2964        in the graph if they have a common boundary.
     2965
     2966        This graph has been built from the data available
     2967        in The CIA World Factbook [CIAWorldFactbook09]_ (2009-08-21).
     2968
     2969        The returned graph ``G`` has a member ``G.gps_coordinates``
     2970        equal to a dictionary containing the GPS coordinates
     2971        of each country's capital city.
     2972
     2973        EXAMPLE::
     2974       
     2975            sage: g=graphs.WorldMap()
     2976            sage: g.has_edge("France","Italy")
     2977            True
     2978       
     2979        REFERENCE:
     2980       
     2981        .. [CIAWorldFactbook09]_ CIA Factbook 09
     2982        https://www.cia.gov/library/publications/the-world-factbook/
     2983        """
     2984
     2985        from sage.structure.sage_object import load
     2986        from sage.misc.misc import SAGE_DATA
     2987        return load(SAGE_DATA+"graphs/graph_world.sobj")
     2988
    29562989################################################################################
    29572990#   Graphs with a given degree sequence
    29582991################################################################################