I have previously reproduced the research made by Hidalgo et al. 2007, where they analysed international trade data in the Product Space.

In that research, they found a relation between economic development and industrial diversification.

With the dataset used we have for every country the destination of every exported product. Now I want to use this dataset and analyse the Countries’ Space while inferring trade blocks.

To this end, I will use a rather limited definition of Trade Block adapting concepts from a Game Theory model.

Trade Block Model

Suppose we have a set of countries named M. In this set we have countries A, B, C, et cetera. We allow for each country to sign two trade agreement: one in which it commits to export and the other is a commitment for imports. It’s not necessary to sign both agreements with the same country. Then, we say that M is trade block if all countries inside M have both agreements signed with countries inside M.

Trade blocks defined this way have an interesting enforcement feature. Suppose M has only three countries: A,B,C. (figure below). And country B denies to import from country A. Then, country A and C can make a coalition to force country B or break the block.

Trade blocks with countries A,B and C

It can be seen that given a set of countries, there are many different ways to assign Trade Agreements. So, I impose a especial restriction. I want all the countries to sign the Agreement with the available country in the highest place in theirs preferences list.

For example, suppose we have again countries A, B and C. Also, we have a trade block M with countries A and B. Then, we know that A prefers B to C and B prefers A to C. Now, we extend this example to A,B,C,D,E. Suppose we do iteratively and we found 2 blocks: A, B and C,D. This time we know that A,B,C,D prefer some country in this set than E. Also A,B prefers this set to C or D. This is a desirable property when thinking about the stability of the game.

Algorithm To Assign Trade Agreements

To Assign Trade Agreements to every country, I will use an algorithm from Game Theory known as The Top Trading Cycle (TTC) algorithm. For every country I define its preferences as the list of countries to which it exports to, sorted by the value of exports.

Then, I ran an iterative process:

  1. Create a bipartite directed graph. In one side the name of the countries with an ‘_exporter’ tag, and in the other side, the name of the countries with an ‘_importer’ tag.

  2. From every ‘_importer’ country draw an edge pointing to the same ‘_exporter’ country. For instance: ‘Brazil_importer’ to ‘Brazil_exporter’

  3. From every ‘_exporter’ draw an edge point in to the country’s most preferred partner in the ‘_importer’ side. Following the example: ’Brazil_exporter’ to ‘USA_importer’.

  4. Detect all the cycles. These are the trade blocks detected in this iteration.

  5. Remove all the countries detected from the list of countries and preferences and return to 1 until no other trade block is found.

Importer Exporter

Importer pointing to Exporter (left), countries pointing to their most preferred destination (center) and first detected cycle (right)

From the algorithm’s description, I want to point out two things: As the number of iterations increase, the trade blocks becomes less evident and not all the countries will be in the final result. This happens because not all the countries exports to all the countries — preferences aren’t complete.


After running the algorithm with the data, I found the following trade blocks.

World Trade Blocks

24 trade blocks splits in two set of 12. The first in the left and the second in the right. Some trade blocks are not shown

Iteration Trade Blocks
Canada, USA
Malaysia, Singapore
Brazil, Argentina
Neth.Ant.Aru, Venezuela
China, China HK SAR
Germany, France,Monac
Czech Rep, Slovakia
Spain, Portugal
Japan, Taiwan
UK, Ireland
Switz.Liecht, Italy
Chile, Mexico
Belgium-Lux, Netherlands
Denmark, Sweden
Slovenia, Croatia
Cyprus, Greece
Hungary, Austria
Belarus, Russian Fed
Finland, Estonia
Turkey, Areas NES, Romania
Tunisia, Libya
Ukraine, Poland
Australia, Korea Rep.
Ecuador, Colombia, Peru
TFYR Macedna, Bulgaria
Iran, South Africa
Thailand, Indonesia
Iceland, Norway
Oman, Untd Arab Em
Pakistan, Bangladesh
Philippines, Viet Nam

There are some interesting features from the Trade Blocks.

  1. Geographical closeness plays a very important role, but there are some exceptions: Chile-Mexico and Iran-South Africa.

  2. Most of the agreements are bilateral with two exceptions: Ecuador-Colombia-Perú and Turkey-Areas NES-Romania. I was expecting to see blocks with at least three countries both in the Euro Zone and in the Mercosur but, apparently, the sizes of the economies plays an important role when finding the Trade Blocks. For example, in the Mercosur area, all the countries have Brazil as the most preferred country.

Colombia Peru Ecuador

Trade Block with Colombia-Peru-Ecuador

To conclude, with few lines of Python’s code some important information can be extracted from the export data. This is a consequence of the strong patterns of trade. Also, questions regarding the importance of the economies sizes arise in this simple model. I want to analyse further those questions using more complex techniques as the model used to detect communities.

Cover Image: Map of the whole world with the trade winds according to ye latest and most exact observations |
Norman B. Leventhal Map Center

Share this via: