# 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
|
|
105 | 105 | - DegreeSequenceConfigurationModel |
106 | 106 | - DegreeSequenceTree |
107 | 107 | - DegreeSequenceExpected |
| 108 | Oddities : |
| 109 | - WorldMap |
108 | 110 | |
109 | 111 | |
110 | 112 | AUTHORS: |
… |
… |
|
128 | 130 | graphs with a given degree sequence, random directed graphs |
129 | 131 | |
130 | 132 | - Robert Miller (2007-10-24): Isomorph free exhaustive generation |
| 133 | |
| 134 | - Nathann Cohen (2009-08-12): WorldMap |
131 | 135 | """ |
132 | 136 | |
133 | 137 | ################################################################################ |
… |
… |
|
219 | 223 | - DegreeSequenceConfigurationModel |
220 | 224 | - DegreeSequenceTree |
221 | 225 | - DegreeSequenceExpected |
222 | | |
| 226 | Oddities : |
| 227 | - WorldMap |
223 | 228 | |
224 | 229 | ORDERLY GENERATION: graphs(vertices, property=lambda x: True, |
225 | 230 | augment='edges', size=None) |
… |
… |
|
2953 | 2958 | import networkx |
2954 | 2959 | return graph.Graph(networkx.random_shell_graph(constructor, seed)) |
2955 | 2960 | |
| 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 | |
2956 | 2989 | ################################################################################ |
2957 | 2990 | # Graphs with a given degree sequence |
2958 | 2991 | ################################################################################ |