In [1]:
import pandas as pd

In [2]:
d = pd.read_table("data/expdata.asc", sep=" ")

In [3]:
d


Out[3]:
&ltclass 'pandas.core.frame.DataFrame'>
Int64Index: 579229 entries, 0 to 579228
Data columns (total 23 columns):
acra      579229  non-null values
numa      579229  non-null values
acrb      579229  non-null values
numb      579229  non-null values
year      579229  non-null values
expab     579229  non-null values
eabo      579229  non-null values
impab     579229  non-null values
iabo      579229  non-null values
expba     579229  non-null values
ebao      579229  non-null values
impba     579229  non-null values
ibao      579229  non-null values
popa      579229  non-null values
rgdpca    579229  non-null values
cgdpca    579229  non-null values
goa       579229  non-null values
popb      579229  non-null values
rgdpcb    579229  non-null values
cgdpcb    579229  non-null values
gob       579229  non-null values
tottra    579229  non-null values
tottrb    579229  non-null values
dtypes: float64(10), int64(3), object(10)

In [4]:
recent = d[d.year == 2000]

In [9]:
recent.describe()


Out[9]:
&ltclass 'pandas.core.frame.DataFrame'>
Index: 8 entries, count to max
Data columns (total 13 columns):
numa      8  non-null values
numb      8  non-null values
year      8  non-null values
expab     8  non-null values
eabo      8  non-null values
impab     8  non-null values
iabo      8  non-null values
expba     8  non-null values
ebao      8  non-null values
impba     8  non-null values
ibao      8  non-null values
tottra    8  non-null values
tottrb    8  non-null values
dtypes: float64(13)

In [6]:
print recent.expab.sum()
print recent.impba.sum()


2942423.012
2905500.544

In [11]:



Out[11]:
52     CAN
80     BHM
133    CUB
186    HAI
239    DOM
278    JAM
317    TRI
352    BAR
375    DMA
402    GRN
424    SLU
446    SVG
466    AAB
484    SKN
537    MEX
...
579042    TON
579065    TUV
579080    MSI
579087    PAL
579102    FSM
579125    TUV
579140    MSI
579147    PAL
579162    FSM
579177    MSI
579184    PAL
579199    FSM
579206    PAL
579221    FSM
579228    FSM
Name: acrb, Length: 17955, dtype: object

In [ ]:


In [ ]:


In [8]:
from countryutils.transformations import *

In [25]:
ninc = set()
inc = set()

def convert(code):
    try:
        c = cca_to_cn(code)
        inc.add(c)
        return c
    except KeyError as e:
        ninc.add(code)

In [26]:
recent['fromName'] = recent.acra.map(convert)

In [31]:
l = list(recent.acra.unique())

In [33]:
sorted(l)


Out[33]:
['AAB',
 'AFG',
 'ALB',
 'ALG',
 'AND',
 'ANG',
 'ARG',
 'ARM',
 'AUL',
 'AUS',
 'AZE',
 'BAH',
 'BAR',
 'BEL',
 'BEN',
 'BFO',
 'BHM',
 'BHU',
 'BLR',
 'BLZ',
 'BNG',
 'BOL',
 'BOS',
 'BOT',
 'BRA',
 'BRU',
 'BUI',
 'BUL',
 'CAM',
 'CAN',
 'CAO',
 'CAP',
 'CDI',
 'CEN',
 'CHA',
 'CHL',
 'CHN',
 'COL',
 'COM',
 'CON',
 'COS',
 'CRO',
 'CUB',
 'CYP',
 'CZR',
 'DEN',
 'DJI',
 'DMA',
 'DOM',
 'DRC',
 'DRV',
 'ECU',
 'EGY',
 'EQG',
 'ERI',
 'EST',
 'ETH',
 'FIN',
 'FJI',
 'FRN',
 'GAB',
 'GAM',
 'GFR',
 'GHA',
 'GNB',
 'GRC',
 'GRG',
 'GRN',
 'GUA',
 'GUI',
 'GUY',
 'HAI',
 'HON',
 'HUN',
 'ICE',
 'IND',
 'INS',
 'IRE',
 'IRN',
 'IRQ',
 'ISR',
 'ITA',
 'JAM',
 'JOR',
 'JPN',
 'KBI',
 'KEN',
 'KUW',
 'KYR',
 'KZK',
 'LAO',
 'LAT',
 'LBR',
 'LEB',
 'LES',
 'LIB',
 'LIE',
 'LIT',
 'LUX',
 'MAA',
 'MAC',
 'MAD',
 'MAG',
 'MAL',
 'MAS',
 'MAW',
 'MEX',
 'MLD',
 'MLI',
 'MLT',
 'MNC',
 'MON',
 'MOR',
 'MSI',
 'MYA',
 'MZM',
 'NAM',
 'NAU',
 'NEP',
 'NEW',
 'NIC',
 'NIG',
 'NIR',
 'NOR',
 'NTH',
 'OMA',
 'PAK',
 'PAL',
 'PAN',
 'PAR',
 'PER',
 'PHI',
 'PNG',
 'POL',
 'POR',
 'PRK',
 'QAT',
 'ROK',
 'RUM',
 'RUS',
 'RWA',
 'SAF',
 'SAL',
 'SAU',
 'SEN',
 'SEY',
 'SIE',
 'SIN',
 'SKN',
 'SLO',
 'SLU',
 'SLV',
 'SNM',
 'SOL',
 'SOM',
 'SPN',
 'SRI',
 'STP',
 'SUD',
 'SUR',
 'SVG',
 'SWA',
 'SWD',
 'SWZ',
 'SYR',
 'TAJ',
 'TAW',
 'TAZ',
 'THI',
 'TKM',
 'TOG',
 'TON',
 'TRI',
 'TUN',
 'TUR',
 'TUV',
 'UAE',
 'UGA',
 'UKG',
 'UKR',
 'URU',
 'USA',
 'UZB',
 'VAN',
 'VEN',
 'YEM',
 'YUG',
 'ZAM',
 'ZIM']

In [38]:
codes = pd.read_table("codesForCountries.txt", header=None, names=['id', "code", "name", "start", "end"])

In [39]:
codes


Out[39]:
&ltclass 'pandas.core.frame.DataFrame'>
Int64Index: 216 entries, 0 to 215
Data columns (total 5 columns):
id       216  non-null values
code     216  non-null values
name     216  non-null values
start    216  non-null values
end      216  non-null values
dtypes: int64(1), object(4)

In [46]:
code_map = {}

for i in codes.index:
    code_map[codes.ix[i]['code']] = codes.ix[i]['name']

In [50]:
ninc = set()
inc = set()

def convert(code):
    try:
        c = code_map[code]
        inc.add(c)
        return c
    except KeyError as e:
        ninc.add(code)

In [51]:
recent['fromName'] = recent.acra.map(convert)

In [54]:
recent['toName'] = recent.acrb.map(convert)

In [55]:
import networkx as nx

In [56]:
g = nx.DiGraph()

In [59]:
for i in recent.index:
    g.add_edge(recent.fromName[i], recent.toName[i], weight=recent.expab[i])

In [60]:
g


Out[60]:
<networkx.classes.digraph.DiGraph at 0x111e1b450>

In [61]:
len(g)


Out[61]:
171

In [64]:
len(g.edges())


Out[64]:
14697

In [84]:
c_inc = pd.read_table("oecd.txt", header=None, names=['country'])

In [85]:
c_inc


Out[85]:
country
0 Australia
1 Austria
2 Belgium
3 Brazil
4 Canada
5 Chile
6 Czech Republic
7 Denmark
8 Estonia
9 Finland
10 France
11 German Federal Republic
12 Greece
13 Hungary
14 Iceland
15 Ireland
16 Israel
17 Italy
18 Japan
19 Korea
20 Luxembourg
21 Mexico
22 Netherlands
23 New Zealand
24 Norway
25 Poland
26 Portugal
27 Russian Federation
28 Slovak Republic
29 Slovenia
30 Spain
31 Sweden
32 Switzerland
33 Turkey
34 United Kingdom
35 United States

In [86]:
c_list = list(c_inc.country)

In [87]:
c_list


Out[87]:
['Australia',
 'Austria',
 'Belgium',
 'Brazil',
 'Canada',
 'Chile',
 'Czech Republic',
 'Denmark',
 'Estonia',
 'Finland',
 'France',
 'German Federal Republic',
 'Greece',
 'Hungary',
 'Iceland',
 'Ireland',
 'Israel',
 'Italy',
 'Japan',
 'Korea',
 'Luxembourg',
 'Mexico',
 'Netherlands',
 'New Zealand',
 'Norway',
 'Poland',
 'Portugal',
 'Russian Federation',
 'Slovak Republic',
 'Slovenia',
 'Spain',
 'Sweden',
 'Switzerland',
 'Turkey',
 'United Kingdom',
 'United States']

In [74]:
g.nodes()


Out[74]:
['Canada',
 'Turkmenistan',
 'Belarus (Byelorussia)',
 'Lithuania',
 'Ethiopia',
 'Swaziland',
 'Argentina',
 'Bolivia',
 'Cameroon',
 'Ghana',
 'Saudi Arabia',
 'Japan',
 'Cape Verde',
 'Slovenia',
 'Guatemala',
 'Kuwait',
 'Spain',
 'Liberia',
 'Netherlands',
 'Pakistan',
 'Oman',
 'Gabon',
 'New Zealand',
 'Jamaica',
 'Albania',
 'United Arab Emirates',
 'India',
 'Azerbaijan',
 'Lesotho',
 'Kenya',
 'Tajikistan',
 'Afghanistan',
 'Czech Republic',
 'Eritrea',
 'Solomon Islands',
 'Mongolia',
 'France',
 'Cote D\x92Ivoire',
 'Rwanda',
 'Slovakia',
 'Somalia',
 'Peru',
 'Laos',
 'Norway',
 'Malawi',
 'Benin',
 'Yemen (Arab Republic of Yemen)',
 'Turkey (Ottoman Empire)',
 'Cuba',
 'United States of America',
 'Togo',
 'China',
 'Armenia',
 'Dominican Republic',
 'Ukraine',
 'Bahrain',
 'Indonesia',
 'Libya',
 'Finland',
 'Central African Republic',
 'Mauritius',
 'Sweden',
 'Mali',
 None,
 'Bulgaria',
 'Fiji',
 'German Federal Republic',
 'Iran (Persia)',
 'Portugal',
 'South Africa',
 'Nicaragua',
 'Qatar',
 'Malaysia',
 'Austria',
 'Mozambique',
 'Uganda',
 'Kyrgyz Republic',
 'Korea, Republic of',
 'Hungary',
 'Niger',
 'Bosnia-Herzegovina',
 'Brazil',
 'Guinea',
 'Panama',
 'Macedonia (Former Yugoslav Republic of)',
 'Costa Rica',
 'Luxembourg',
 'Bahamas',
 'Ireland',
 'Nigeria',
 'Ecuador',
 'Tanzania/Tanganyika',
 'Brunei',
 'Australia',
 'Algeria',
 'El Salvador',
 'Italy/Sardinia',
 'Vietnam, Democratic Republic of',
 'Russia (Soviet Union)',
 'Chile',
 'Belgium',
 'Thailand',
 'Haiti',
 'Belize',
 'Sierra Leone',
 'Georgia',
 'Sri Lanka (Ceylon)',
 'Gambia',
 'Poland',
 'Moldova',
 'Zimbabwe (Rhodesia)',
 'Croatia',
 'Guinea-Bissau',
 'Switzerland',
 'Angola',
 'Bangladesh',
 'Iraq',
 'Chad',
 'Estonia',
 'Uruguay',
 'Mexico',
 'Lebanon',
 'Uzbekistan',
 'Egypt',
 'Djibouti',
 'Colombia',
 'Burundi',
 'Taiwan',
 'Cyprus',
 'Barbados',
 'Madagascar',
 'Bhutan',
 'Sudan',
 "Korea, People's Republic of",
 'Nepal',
 'Malta',
 'Maldives',
 'Cambodia (Kampuchea)',
 'Venezuela',
 'United Kingdom',
 'Israel',
 'Myanmar (Burma)',
 'Iceland',
 'Zambia',
 'Senegal',
 'Papua New Guinea',
 'Jordan',
 'Denmark',
 'Yugoslavia',
 'Kazakhstan',
 'Philippines',
 'Mauritania',
 'Congo, Democratic Republic of (Zaire)',
 'Trinidad and Tobago',
 'Latvia',
 'Guyana',
 'Syria',
 'Morocco',
 'Honduras',
 'Equatorial Guinea',
 'Tunisia',
 'Singapore',
 'Surinam',
 'Comoros',
 'Rumania',
 'Congo',
 'Burkina Faso (Upper Volta)',
 'Greece',
 'Paraguay',
 'Namibia',
 'Botswana']

In [92]:
sg = nx.DiGraph()
rejected = set()

for i in recent.index:
    if(recent.fromName[i] in c_list and recent.toName[i] in c_list):
        sg.add_edge(recent.fromName[i], recent.toName[i], weight=recent.expab[i])
    else:
        if((not recent.fromName[i] in c_list) and (not recent.toName[i] in c_list)):
            rejected.add(recent.fromName[i])
            rejected.add(recent.toName[i])

In [93]:
sg


Out[93]:
<networkx.classes.digraph.DiGraph at 0x106d0cb10>

In [94]:
sg.nodes()


Out[94]:
['Canada',
 'Brazil',
 'Czech Republic',
 'Luxembourg',
 'France',
 'Ireland',
 'Norway',
 'Israel',
 'Australia',
 'Iceland',
 'Slovenia',
 'Chile',
 'Belgium',
 'Spain',
 'Netherlands',
 'Denmark',
 'Poland',
 'Finland',
 'Sweden',
 'Japan',
 'Switzerland',
 'New Zealand',
 'German Federal Republic',
 'Estonia',
 'Portugal',
 'Mexico',
 'United Kingdom',
 'Austria',
 'Greece',
 'Hungary']

In [95]:
sorted(rejected)


Out[95]:
[None,
 'Afghanistan',
 'Albania',
 'Algeria',
 'Angola',
 'Argentina',
 'Armenia',
 'Azerbaijan',
 'Bahamas',
 'Bahrain',
 'Bangladesh',
 'Barbados',
 'Belarus (Byelorussia)',
 'Belize',
 'Benin',
 'Bhutan',
 'Bolivia',
 'Bosnia-Herzegovina',
 'Botswana',
 'Brunei',
 'Bulgaria',
 'Burkina Faso (Upper Volta)',
 'Burundi',
 'Cambodia (Kampuchea)',
 'Cameroon',
 'Cape Verde',
 'Central African Republic',
 'Chad',
 'China',
 'Colombia',
 'Comoros',
 'Congo',
 'Congo, Democratic Republic of (Zaire)',
 'Costa Rica',
 'Cote D\x92Ivoire',
 'Croatia',
 'Cuba',
 'Cyprus',
 'Djibouti',
 'Dominican Republic',
 'Ecuador',
 'Egypt',
 'El Salvador',
 'Equatorial Guinea',
 'Eritrea',
 'Ethiopia',
 'Fiji',
 'Gabon',
 'Gambia',
 'Georgia',
 'Ghana',
 'Guatemala',
 'Guinea',
 'Guinea-Bissau',
 'Guyana',
 'Haiti',
 'Honduras',
 'India',
 'Indonesia',
 'Iran (Persia)',
 'Iraq',
 'Italy/Sardinia',
 'Jamaica',
 'Jordan',
 'Kazakhstan',
 'Kenya',
 "Korea, People's Republic of",
 'Korea, Republic of',
 'Kuwait',
 'Kyrgyz Republic',
 'Laos',
 'Latvia',
 'Lebanon',
 'Lesotho',
 'Liberia',
 'Libya',
 'Lithuania',
 'Macedonia (Former Yugoslav Republic of)',
 'Madagascar',
 'Malawi',
 'Malaysia',
 'Maldives',
 'Mali',
 'Malta',
 'Mauritania',
 'Mauritius',
 'Moldova',
 'Mongolia',
 'Morocco',
 'Mozambique',
 'Myanmar (Burma)',
 'Namibia',
 'Nepal',
 'Nicaragua',
 'Niger',
 'Nigeria',
 'Oman',
 'Pakistan',
 'Panama',
 'Papua New Guinea',
 'Paraguay',
 'Peru',
 'Philippines',
 'Qatar',
 'Rumania',
 'Russia (Soviet Union)',
 'Rwanda',
 'Saudi Arabia',
 'Senegal',
 'Sierra Leone',
 'Singapore',
 'Slovakia',
 'Solomon Islands',
 'Somalia',
 'South Africa',
 'Sri Lanka (Ceylon)',
 'Sudan',
 'Surinam',
 'Swaziland',
 'Syria',
 'Taiwan',
 'Tajikistan',
 'Tanzania/Tanganyika',
 'Thailand',
 'Togo',
 'Trinidad and Tobago',
 'Tunisia',
 'Turkey (Ottoman Empire)',
 'Turkmenistan',
 'Uganda',
 'Ukraine',
 'United Arab Emirates',
 'United States of America',
 'Uruguay',
 'Uzbekistan',
 'Venezuela',
 'Vietnam, Democratic Republic of',
 'Yemen (Arab Republic of Yemen)',
 'Yugoslavia',
 'Zambia',
 'Zimbabwe (Rhodesia)']

In [80]:
sorted(c_list)


Out[80]:
['Australia',
 'Austria',
 'Belgium',
 'Brazil',
 'Canada',
 'Chile',
 'Czech Republic',
 'Denmark',
 'Estonia',
 'Finland',
 'France',
 'Germany',
 'Greece',
 'Hungary',
 'Iceland',
 'Ireland',
 'Israel',
 'Italy',
 'Japan',
 'Korea',
 'Luxembourg',
 'Mexico',
 'Netherlands',
 'New Zealand',
 'Norway',
 'Poland',
 'Portugal',
 'Russian Federation',
 'Slovak Republic',
 'Slovenia',
 'Spain',
 'Sweden',
 'Switzerland',
 'Turkey',
 'United Kingdom',
 'United States']

In [81]:
set(c_list).intersection(rejected)


Out[81]:
set(['Brazil',
     'Canada',
     'Czech Republic',
     'Luxembourg',
     'France',
     'Ireland',
     'Norway',
     'Israel',
     'Australia',
     'Iceland',
     'Slovenia',
     'Chile',
     'Belgium',
     'Spain',
     'Netherlands',
     'Denmark',
     'Poland',
     'Finland',
     'Sweden',
     'Hungary',
     'Switzerland',
     'New Zealand',
     'Estonia',
     'Portugal',
     'Mexico',
     'United Kingdom',
     'Austria',
     'Greece',
     'Japan'])

In [83]:
recent.toName.unique()


Out[83]:
array(['Canada', 'Bahamas', 'Cuba', 'Haiti', 'Dominican Republic',
       'Jamaica', 'Trinidad and Tobago', 'Barbados', None, 'Mexico',
       'Belize', 'Guatemala', 'Honduras', 'El Salvador', 'Nicaragua',
       'Costa Rica', 'Panama', 'Colombia', 'Venezuela', 'Guyana',
       'Surinam', 'Ecuador', 'Peru', 'Brazil', 'Bolivia', 'Paraguay',
       'Chile', 'Argentina', 'Uruguay', 'United Kingdom', 'Ireland',
       'Netherlands', 'Belgium', 'Luxembourg', 'France', 'Switzerland',
       'Spain', 'Portugal', 'German Federal Republic', 'Poland', 'Austria',
       'Hungary', 'Czech Republic', 'Slovakia', 'Italy/Sardinia', 'Malta',
       'Albania', 'Macedonia (Former Yugoslav Republic of)', 'Croatia',
       'Yugoslavia', 'Bosnia-Herzegovina', 'Slovenia', 'Greece', 'Cyprus',
       'Bulgaria', 'Moldova', 'Rumania', 'Russia (Soviet Union)',
       'Estonia', 'Latvia', 'Lithuania', 'Ukraine',
       'Belarus (Byelorussia)', 'Armenia', 'Georgia', 'Azerbaijan',
       'Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland', 'Cape Verde',
       'Guinea-Bissau', 'Equatorial Guinea', 'Gambia', 'Mali', 'Senegal',
       'Benin', 'Mauritania', 'Niger', 'Cote D\x92Ivoire', 'Guinea',
       'Burkina Faso (Upper Volta)', 'Liberia', 'Sierra Leone', 'Ghana',
       'Togo', 'Cameroon', 'Nigeria', 'Gabon', 'Central African Republic',
       'Chad', 'Congo', 'Congo, Democratic Republic of (Zaire)', 'Uganda',
       'Kenya', 'Tanzania/Tanganyika', 'Burundi', 'Rwanda', 'Somalia',
       'Djibouti', 'Ethiopia', 'Eritrea', 'Angola', 'Mozambique', 'Zambia',
       'Zimbabwe (Rhodesia)', 'Malawi', 'South Africa', 'Namibia',
       'Lesotho', 'Botswana', 'Swaziland', 'Madagascar', 'Comoros',
       'Mauritius', 'Morocco', 'Algeria', 'Tunisia', 'Libya', 'Sudan',
       'Iran (Persia)', 'Turkey (Ottoman Empire)', 'Iraq', 'Egypt',
       'Syria', 'Lebanon', 'Jordan', 'Israel', 'Saudi Arabia',
       'Yemen (Arab Republic of Yemen)', 'Kuwait', 'Bahrain', 'Qatar',
       'United Arab Emirates', 'Oman', 'Afghanistan', 'Turkmenistan',
       'Tajikistan', 'Kyrgyz Republic', 'Uzbekistan', 'Kazakhstan',
       'China', 'Mongolia', 'Taiwan', "Korea, People's Republic of",
       'Korea, Republic of', 'Japan', 'India', 'Bhutan', 'Pakistan',
       'Bangladesh', 'Myanmar (Burma)', 'Sri Lanka (Ceylon)', 'Maldives',
       'Nepal', 'Thailand', 'Cambodia (Kampuchea)', 'Laos',
       'Vietnam, Democratic Republic of', 'Malaysia', 'Singapore',
       'Brunei', 'Philippines', 'Indonesia', 'Australia',
       'Papua New Guinea', 'New Zealand', 'Solomon Islands', 'Fiji'], dtype=object)

In [97]:
len(sg.edges())


Out[97]:
435

In [111]:


In [129]:
def top_value(dict_of_weights):
    weights = []
    for k,v in dict_of_weights.iteritems():
        weights.append(v['weight'])
    if len(weights) > 2:
        return sorted(weights)[-3] - 0.0001
    elif len(weights) > 0:
        return sorted(weights)[0] - 0.0001
    else:
        return 0.0

In [130]:
top_value(sg['United Kingdom'])


Out[130]:
22220.999899999999

In [102]:



Out[102]:
{'Australia': {'weight': 4057.0},
 'Austria': {'weight': 1697.0},
 'Belgium': {'weight': 14873.0},
 'Czech Republic': {'weight': 1403.0},
 'Denmark': {'weight': 3458.0},
 'Estonia': {'weight': 139.0},
 'Finland': {'weight': 2177.0},
 'France': {'weight': 27545.0},
 'German Federal Republic': {'weight': 33720.0},
 'Greece': {'weight': 1837.0},
 'Hungary': {'weight': 921.0},
 'Iceland': {'weight': 300.0},
 'Ireland': {'weight': 19096.0},
 'Israel': {'weight': 2300.0},
 'Japan': {'weight': 5552.0},
 'Luxembourg': {'weight': 334.0},
 'Netherlands': {'weight': 22221.0},
 'New Zealand': {'weight': 460.0},
 'Norway': {'weight': 3144.0},
 'Poland': {'weight': 1978.0},
 'Portugal': {'weight': 2506.0},
 'Slovenia': {'weight': 239.0},
 'Spain': {'weight': 12285.0},
 'Sweden': {'weight': 6267.0},
 'Switzerland': {'weight': 4763.0}}

In [131]:
refined = nx.Graph()

for n in sg.nodes_iter():
    nedges = sg[n]
    min_val = top_value(nedges)
    for k,v in nedges.iteritems():
        if v['weight'] > min_val:
            refined.add_edge(n, k)

In [132]:
refined


Out[132]:
<networkx.classes.graph.Graph at 0x11276fc90>

In [133]:
len(refined.edges())


Out[133]:
84

In [134]:
nx.draw(refined)



In [136]:
from networkx.readwrite import json_graph

json_graph.node_link_data(refined)


Out[136]:
{'directed': False,
 'graph': [],
 'links': [{'source': 0, 'target': 26},
  {'source': 0, 'target': 29},
  {'source': 0, 'target': 22},
  {'source': 1, 'target': 29},
  {'source': 1, 'target': 14},
  {'source': 1, 'target': 22},
  {'source': 2, 'target': 15},
  {'source': 2, 'target': 16},
  {'source': 2, 'target': 27},
  {'source': 2, 'target': 10},
  {'source': 2, 'target': 18},
  {'source': 2, 'target': 19},
  {'source': 3, 'target': 22},
  {'source': 3, 'target': 13},
  {'source': 3, 'target': 4},
  {'source': 4, 'target': 14},
  {'source': 4, 'target': 22},
  {'source': 4, 'target': 11},
  {'source': 4, 'target': 26},
  {'source': 4, 'target': 12},
  {'source': 4, 'target': 5},
  {'source': 4, 'target': 20},
  {'source': 4, 'target': 13},
  {'source': 5, 'target': 14},
  {'source': 5, 'target': 22},
  {'source': 6, 'target': 24},
  {'source': 6, 'target': 15},
  {'source': 6, 'target': 17},
  {'source': 6, 'target': 18},
  {'source': 6, 'target': 9},
  {'source': 6, 'target': 29},
  {'source': 7, 'target': 29},
  {'source': 7, 'target': 21},
  {'source': 7, 'target': 8},
  {'source': 7, 'target': 28},
  {'source': 8, 'target': 9},
  {'source': 8, 'target': 29},
  {'source': 8, 'target': 21},
  {'source': 8, 'target': 15},
  {'source': 9, 'target': 29},
  {'source': 9, 'target': 21},
  {'source': 9, 'target': 15},
  {'source': 10, 'target': 15},
  {'source': 10, 'target': 27},
  {'source': 10, 'target': 18},
  {'source': 10, 'target': 28},
  {'source': 10, 'target': 19},
  {'source': 11, 'target': 26},
  {'source': 11, 'target': 29},
  {'source': 12, 'target': 14},
  {'source': 12, 'target': 22},
  {'source': 12, 'target': 13},
  {'source': 13, 'target': 22},
  {'source': 13, 'target': 24},
  {'source': 13, 'target': 25},
  {'source': 13, 'target': 28},
  {'source': 14, 'target': 22},
  {'source': 14, 'target': 26},
  {'source': 15, 'target': 23},
  {'source': 15, 'target': 16},
  {'source': 15, 'target': 17},
  {'source': 15, 'target': 18},
  {'source': 15, 'target': 29},
  {'source': 16, 'target': 18},
  {'source': 16, 'target': 22},
  {'source': 17, 'target': 18},
  {'source': 17, 'target': 23},
  {'source': 17, 'target': 28},
  {'source': 18, 'target': 24},
  {'source': 18, 'target': 19},
  {'source': 18, 'target': 22},
  {'source': 18, 'target': 23},
  {'source': 18, 'target': 28},
  {'source': 18, 'target': 29},
  {'source': 19, 'target': 27},
  {'source': 20, 'target': 29},
  {'source': 20, 'target': 27},
  {'source': 20, 'target': 22},
  {'source': 21, 'target': 29},
  {'source': 22, 'target': 24},
  {'source': 22, 'target': 25},
  {'source': 22, 'target': 27},
  {'source': 22, 'target': 26},
  {'source': 25, 'target': 29}],
 'multigraph': False,
 'nodes': [{'id': 'Canada'},
  {'id': 'Brazil'},
  {'id': 'Czech Republic'},
  {'id': 'Luxembourg'},
  {'id': 'France'},
  {'id': 'Ireland'},
  {'id': 'Norway'},
  {'id': 'Israel'},
  {'id': 'Australia'},
  {'id': 'Iceland'},
  {'id': 'Slovenia'},
  {'id': 'Chile'},
  {'id': 'Belgium'},
  {'id': 'Spain'},
  {'id': 'Netherlands'},
  {'id': 'Denmark'},
  {'id': 'Poland'},
  {'id': 'Finland'},
  {'id': 'Sweden'},
  {'id': 'Hungary'},
  {'id': 'Switzerland'},
  {'id': 'New Zealand'},
  {'id': 'German Federal Republic'},
  {'id': 'Estonia'},
  {'id': 'Portugal'},
  {'id': 'Mexico'},
  {'id': 'United Kingdom'},
  {'id': 'Austria'},
  {'id': 'Greece'},
  {'id': 'Japan'}]}

In [ ]: