Introduction

A natural way of representing international trade flows is through complex networks (De Benedictis and Tajoli, 2011; Fronczak and Fronczak, 2012; Nemeth and Smith, 1985; Smith and White, 1992). The key advantage of this approach is that it captures the complex structure of the interactions between a large number of economic agents, which brings solutions to a variety of issues in observation, modeling, and prediction (Fagiolo et al., 2013; Medo et al., 2018; Saracco et al., 2015, 2016; Schweitzer et al., 2009; Squartini et al., 2018, 2015). In recent works, substantial effort has been devoted to analyzing the structural characteristics of the world trade data as it is closely connected to the economic development of countries (Cristelli et al., 2015; Hartmann et al., 2017; Hausmann et al., 2014; Hidalgo and Hausmann, 2009; Hidalgo et al., 2007; Tacchella et al., 2012). The related works form a new research field called economic complexity, which aims to understand the emergent complex behaviors in economic systems via the tools developed in complexity science (Hidalgo, 2018; Mealy et al., 2019; Tacchella et al., 2018). The data was modeled with a country-product bipartite network with links representing export relations. A remarkable finding is that the network exhibits a hierarchically nested structure, which is already widely observed economic systems originated form ecological systems (Bastolla et al., 2009; König et al., 2014; Rohr et al., 2014), and how nestedness emerges and what is its determinants raises a lot of concentration (James et al., 2012; Jonhson et al., 2013; Payrato-Borras et al., 2019). Recently, the review (Mariani et al., 2019) surveys nestedness from variegated disciplines, including statistical physics, graph theory, ecology, and theoretical economics.

Given an adjacent matrix by a network of interacting nodes, a perfectly nested matrix can be described as the entries in each successive row and column are, respectively, a strict subset of those in the previous row and column (Almeida-Neto et al., 2008) as seen in Fig. 1a. In ecological systems, a nested pattern in mutualistic networks promotes biodiversity and preserves structural stability (Bastolla et al., 2009; Rohr et al., 2014). In economic systems, the function of the nested structure is not yet clear, but this feature has already inspired many methods quantifying different aspects of these systems. Issues include exploring the nested nature of the observed networks (de Jeude et al., 2019; König et al., 2014; Lee, 2016; Solé-Ribalta et al., 2018), as well as predicting the evolution of industrial ecosystems (Brintrup et al., 2015; Bustos et al., 2012; Saavedra et al., 2014). The representation of the international trading data with country-product bipartite networks overly simplifies the system. The country-product bipartite network only consists of the products that each country exports, but neglects the information of which countries these products are shipped to. Attempts have also been made to construct a multilayer network in which the nodes are the countries, the layers are the industries, and links can be established from sellers to buyers within and across industries (Alves et al., 2019; Barigozzi et al., 2010; Mastrandrea et al., 2014). The advantage of modeling a complex system as a multilayer network is to gain information that cannot be captured if individual layers are taken in isolation. The methods for analyzing multilayer networks such as community detection, cascading failure, node centrality, and network reducibility have developed rapidly in recent years (Boccaletti et al., 2014). In this work, we focus on the within-layer nestedness of the multilayer world trade network, and find that the nestedness of a layer network is a proper method to quantify the product’s complexity. For the highly complex products, only the countries with advanced technologies can produce them and export them to further countries, resulting from a nested network structure. We then use the nestedness to investigate the evolution of product complexity. Further, we analyze that the competitiveness of a country with different nested products and then take a comparison of trade competitive of countries between China and United States. In addition, we propose a aggregated nestedness index to predict a nation’s future economic growth.

Fig. 1: Nestedness in multilayer networks.
figure 1

a, b Three representations of matrices, respectively, correspond to none, moderate, perfect nested network. These three networks have the same number of nodes and links. In each matrix, the rows and columns have been ranked by the number of ones (i.e., degree). In a perfectly nested matrix, the upper-left triangle would be full of elements and the lower-right triangle would have no elements. c The matrices are representations of the different layers of world trade networks which, respectively, correspond to the network of Bovine, Typewriters, and Medical Instruments. The nestedness of matrices (NODF) is 0.12, 0.37, and 0.60, respectively. The curve is the distribution of nestedness calculated by 786 matrices of products.

Methods

The world trade datasets of different products between countries by years from publicly available databases (Data source is seen in section Data Availability). The data comprises 261 countries and 786 products (categories) from 1976 to 2014. For a detailed introduction to datasets, one can refer to Supplementary S1. The trade flow is used to construct a multilayer network in which each layer is a directed network representing the export and import relations of a product. Each layer trading network can be characterized by a matrix with each element as \({M}^{p}=\left\{{v}_{cc^{\prime} }^{p}\right\}\), where \({v}_{cc^{\prime} }^{p}\) is the dollar volume of a product p exported from the exporter c to the importer \(c^{\prime}\). To define the presence and the absence of the element in a matrix, we employ z-score to parameterize the volume of the trade flow to determine whether a trade flow can be considered significant or not. Mathematically, \(z=({v}_{cc^{\prime} }^{p}-<{v}^{p}>)/{\sigma }^{p}\), where <vp> and σp are, respectively, the mean and standard deviation of the dollar volume of a sample product p of the world trade network. Thus, we can obtain a binary matrix by a threshold of z. If z ≥ 0, \({v}_{cc^{\prime} }^{p}=1\), otherwise \({v}_{cc^{\prime} }^{p}=0\). Through these operations, we can build the multilayer world trade network.

We mainly focus on the nested structure of the multilayer world trade network. The nestedness of a network layer can be detected from its adjacency matrix. In a perfectly nested matrix, the elements in each sequential row are a strict subset of those in the upper row, while the elements in each sequential column are a strict subset of those in the upper column. A typical feature of a nested network in visualization is that the adjacency matrix shows a clear triangular pattern. There are also numerous metrics to quantify the nestedness of a matrix (Almeida-Neto et al., 2008; Bastolla et al., 2009; Beckett et al., 2014). Figure 1a illustrates the adjacency matrices of three toy networks with the same number of elements but the different level of nestedness. The rows and columns of these matrices are both reordered by descending degree (k). The matrix on the right is a fully nested matrix, while the matrix on the left has no nested feature. The network visualizations of these three matrices are given in Fig. 1b. Although the number of nodes and links are the same in these networks, the level of nestedness is totally different as the nestedness is determined by the particular directionality of links.

Here, we introduce a simple and widely used metric named Nested Overlap and Decreasing Fill (NODF) η(Almeida-Neto et al., 2008). η ranges from 0 to 1, with 1 indicating a perfectly nested structure and 1 indicating a none nested. The NODF calculation starts with a simple description: after sorting the adjacent matrix by descending indegree and outdegree, respectively, the nestedness of a pair of nodes is defined as \({\eta }_{ij}={N}_{ij}/\min ({k}_{i},{k}_{j})\) if ki ≠ kj, otherwise ηij = 0. Here Nij is the number of the commonly connected nodes shared by node i and node j. Thus, the nestedness of the matrix is the average of total pairs of nestedness. The step by step calculation is illustrated in Supplementary S2. According to the NODF metric, the nestedness of three toy networks, respectively, corresponds to 0, 0.5, 1 as shown in Fig. 1a. Thereupon we further quantify the nestedness in each layer of the multilayer world trade network with the NODF metric and report the distribution of nestedness calculated by 786 matrices of products in Fig. 1c. One can see that the nestedness of 786 layers varies significantly. The nestedness is <0.2 or >0.6, which account for <5%, but >10% in [0.3, 0.5]. For instance, the matrices are representations of the different layer of world trade networks which, respectively, corresponds to the network of Bovine, Typewriters, and Medical Instruments. The visualization of these three network is also shown in Supplementary Fig. S4. The nestedness of Bovine, Motorcycles, and Medical Instruments is 0.12, 0.35, and 0.60, respectively, which locates in the low, medium, and high areas of nestedness distribution.

Results

Nestedness characterizes product complexity

A number of metrics have been developed to quantify the competitiveness of countries and the complexity of products, with the iterative processes on the country-product bipartite networks. Examples include the measurements of ubiquity and diversity (Hidalgo and Hausmann, 2009; Hidalgo et al., 2007), eigenvector-based complexity index (ECI) (Hartmann et al., 2017; Hausmann et al., 2014; Hidalgo and Hausmann, 2009), and fitness and complexity index (FCI) (Cristelli et al., 2015; Tacchella et al., 2012), which are, respectively, introduced in Supplementary S4. As an alternative metric, we aim to employ the nestedness of a network layer to quantify the complexity of the corresponding product. This is motivated by the previous examples of Bovine, Typewriters, and Medical Instruments in Fig. 1c. In agreement with the recent advance in the economic complexity (Hidalgo, 2018; Tacchella et al., 2018), the low complexity products do not have a strong technology barrier, so almost all country could produce and export them. In this case, the structure of the trading network is mainly determined by the geographic location (Fujita et al., 1999) and a nested structure is not expected. However, for the high-complexity products, only the countries with advanced technologies can produce them and export them to further countries.

It is well known that the technology barrier extensively exists in world trade due to the sophisticated technologies hold by some countries (Hausmann et al., 2014). The complex products are produced by a small number of countries and exported to other countries that do not hold the technology. This implies that the large out-degree countries in the layers with high nestedness are the countries possessing advanced technologies. To confirm this point, we consider the technology achievement index (TAI), which is widely used to measure the capacity of a country in technological innovations by the United Nations Development Program (Desai et al., 2002; Nasir et al., 2011). We compute the mean TAI of countries with top 10 out-degree in each layer, with the results presented in Fig. 2a and Supplementary S5.1. It is clear that 〈TAI〉 increases with η, which indicates that the products in the trading network with high nestedness indeed export from the high-technology countries to other countries. Moreover, the high-technology barrier in international trade will result in the emergence of high asymmetry in the network of high-complexity products. As shown in Fig. 2(b), the asymmetry of a network is captured by the dispersion of in-out degree as \(\,\text{Asy}\,=\sqrt{{\sum }_{i}{({k}_{i}^{in}-{k}_{i}^{out})}^{2}/N}\), where \({k}_{i}^{{\mathrm{in}}}\) and \({k}_{i}^{{\mathrm{out}}}\) represent indegree and outdegree, and N is the number of nodes. Asy ≥ 0. If Asy = 0, the indegree of each node equals the outdegree. An undirected network is perfectly symmetry (Asy = 0) as seen in Fig. 2(b). In an asymmetric network, the indegree of nodes is not consistent with outdegree and Asy > 0. We calculate the asymmetry of the network layer corresponding to each product. In Fig. 2(c), one can see that the asymmetry of products is positively correlated with the nestedness η of their trading networks, indicating that higher nestedness reflects the stronger asymmetric property of the complex products. In addition, bright points in Fig. 2(c) are the mean asymmetry of the 786 products belonging to different sectors whose name is seen in subfigure (d). The sectors (8, 7, 5, 6) of the machinery and chemicals with high nestedness are more asymmetric than the sectors (3, 4, 2, 0, 1) of raw materials (such as beverages and tobacco, food, crude inedible materials, mineral fuels, lubricants, animal and vegetable oils, fats and waxes) with low nestedness. The above analysis indicates that the nestedness of the trading network is strongly connected with the complexity of the traded product.

Fig. 2: Detection of product complexity.
figure 2

a The countries with advanced technologies in a nested matrix. We use the TAI index to measuring the technology achievement of nations (Desai et al., 2002; Nasir et al., 2011). The higher TAI indicates the higher national technological capability of a country. <TAI> top10 is the mean TAI of the countries with the top 10 out-degree in each layer. b The asymmetry of a network that characterizes the dispersion between the node’s indegree and outdegree. The asymmetry of a directed network is 2, but the asymmetry of an indirected network is 0. c The asymmetry of nested networks. Gray points correspond to 786 products. Bright points are the mean asymmetry of the products belonging to different sectors. Red numbers correspond to sector numbers in subfigure (d). d Red points are the mean nestedness value of products from ten sectors classified according to the SITC code (detailed introduction seen in Supplementary Table S3). Black points are nestedness value of 786 products.

To validate the nestedness as a measure of product complexity, we compare the mean nestedness value of different types of products. The 786 products are classified into 10 sectors by Standard International Trade Classification (SITC) (classification of the product as seen in Supplementary Table S3). For each sector we compute \(\left\langle \eta (s)\right\rangle ={\sum }_{i\in s}\eta (i)/N(i\in s)\), where i is a product of sector s, η(i) is nestedness value of product i, N(i s) is the number of products belonging to the sector s. In Figure 2d, one can see that nestedness gives a reasonable ranking of these product sectors. Specifically, the sectors (8, 7, 5, 6) include machinery and chemicals are large nestedness, while the nestedness of the sectors (3, 4, 2, 0, 1) of raw materials (such as beverages and tobacco, food, crude inedible materials, mineral fuels, lubricants, animal and vegetable oils, fats and waxes) are lower. It is interesting that sector 9 (Commodities and transactions not classified elsewhere in the SITC) ranks in the middle position. In addition, we give the distribution of products in each sector in Supplementary Fig. S9.

We also illustrate the detailed top-10 most and last-10 worst complex products in Table 1. In top 10 nestedness ranking list, we find that these 10 products are sophisticated machinery, but last-10 products are those raw materials, but corresponding to the measurements of ubiquity, ECI, and FCI, their top 10 lists appear a few primary products like Castor Oil, Raw Cork, Miscellaneous printed matter as shown in Supplementary Table S4 and S5. In addition, we also find the low correlation between nestedness and the measurements of ubiquity, ECI, and FCI as seen in Supplementary Fig. S10, which we think the principle of nested structure could be independent from the other measurements. These results could provide clear evidence that nestedness can give an alternative quantification of products’ complexity.

Table 1 The Top 10 and bottom 10 products are ranked by the nestedness.

We use the nestedness to investigate the evolution of product complexity, and take the highest nested product types at different levels and observe the evolution of their average nestedness from 1986 to 2014 as shown in Fig. 3a. The four subplots, respectively, reveal the nestedness of the four levels, 8 Miscellaneous manufactured articles, 87 Professional, scientific, controlling instruments, apparatus, nes, 874 Measuring, checking, analysis, controlling instruments, nes, parts and the detailed 7 products contained by 874. We can observe that the nested structure of commodities at different levels is changing over time. On the whole, the nested structure is weakening. However, for products with the most nested structure, their changes are small. To quantify the nestedness evolution of the products, we consider top-20 products Ω at time t,

$$v=\frac{{\sum }_{i\in \Omega }{\mathrm{rank}}(i,t+\Delta t)}{{\sum }_{i\in \Omega }{\mathrm{rank}}(i,t)},$$
(1)

where rank(i, t) and rank(i, t + Δt) are, respectively, the ranking position of the product i at time t and t + Δt. Figure 3b shows the value of the top-20 products v under different Δt with the data from 1986 to 2005. We find that v rises fast but decay slowly. The trend is more pronounced when Δt is larger. At the same time, we compute the mean value of v by averaging two decades data. As shown in Fig. 3c, we can see a clearer trend that 〈v〉 is asymmetric between Δt < 0 and Δt > 0, indicating that the growth of product nestedness is faster than the relevance decay. We could suggest the trend that the product complexity would decline over time that depends on an advance of science and technology.

Fig. 3: Nestedness evolution in four levels from 1986 to 2014.
figure 3

a The highest nested products in different levels. (i) 1-digit. The first level products that can be regarded as ten sectors. (ii) 2-digit. We select the highest nested sector in the first level, i.e., nine miscellaneous manufactured articles. The ninth sector is subdivided into eight divisions. (iii) 3-digit. We also select the highest nested division in the second level that is 87 Professional, scientific, controlling instruments, apparatus, nes. The group can be subdivided into four groups. (iv) 4-digit. At last, we again select the highest nested group, which is 874 Measuring, checking, analysis, controlling instruments, nes, parts. This subgroup consists of seven products. b We investigate that how the ranking positions of the set of 20 top nested products change in 20 years. We choose the top 20 nested products from 1986 to 2005. The current seems as t and the time period Δt [−10, 10]. c Averaging the change rate of the top 20 nested products from 1986 to 2005. The gray area represents the error bar.

Quantifying economic competitiveness between China and the United States

We remark that the competitiveness of a country can also be measured based on the nestedness of the products exported. For a given product, if a country can export the product to more countries, this country occupies more market share. Thus, we can directly compute the number of countries that a country exports to in a given product’s network layer as its trade competitiveness with respect to this product (\(\kappa (c,p)={\sum }_{c^{\prime} }{M}_{cc^{\prime} }(p)\)). Following the train of thought, we compare the trade competitiveness of the United States and China limited to a year 2010 as shown in Fig. 4a. We could find that China has the trade competitiveness of the products whose nestedness ranges from 0.35 to 0.5, corresponding to the products such as footwear, motorcycles, and electronics. While, the United States takes a distinct advantage of raw materials with η < 0.35 and sophisticated products with η > 0.5. In general, the competitiveness of these two countries is increasing with the complexity of products.

Fig. 4: Quantifying trade competitive of countries.
figure 4

a Quantifying trade competitive of three countries with different nested product networks. The curves stand for the United States (USA), China (CHN). b, c The evolution of trade competitive with the nested products for China (b) and the United States (c). If the normalized trade competitive is closer to 1, the country has stronger trade competitive. The heatmap depicts the evolution of trade competitiveness with high-nested products corresponding to normalized nestedness.

In addition, we analyze the evolution of trade competitive with the nested products for the United States and China. We first normalized the nestedness values in a given year according \(\tilde{\eta }(i,t)=\eta (i,t)/\max (\{\eta (i,t)\})\). We also compare a given trade competitive to the country with highest trade advantage according to \(\tilde{\kappa }(c,t)=\kappa (c,t)/\max (\{\kappa (c,t)\})\). Thus, if the normalized trade competitive is closer to 1, the country has stronger trade competitive. In Fig. 4b, c, the heatmap depicts the evolution of trade competitive with different nested products between China and the United States. One can find that these two countries have different trends in evolution. From 1976 to 2014, the United States always keeps great trade competitiveness, especially keeps greater trade competitiveness in raw materials with low nestedness and sophisticated products with high nestedness. While China’s trade competitiveness gradually become great after 1990, especially after 2005, The high-nested product of trade competitiveness become stronger. These may be found that the trade advantage of China boosts to the top level in recent two decades could due to the economic take-off.

Predicting some representative economic indexes

Finally, we can extend the trade competitiveness κ(c, p) in single-network layer to the whole multilayer network, and define the global trade competitiveness as GTC(c) = ∑pκ(c, p)η(p), where η(p) is the nestedness of the product p. Therefore, GTC(c) is the weighted sum of κ(c, p) by η(p) of all the product p that c exports. We first examine the prediction power of GTC by analyzing the correlation between GTC and some representative economic indexes (GDP, GDPpc, GDP(PPP), GDP(PPP)pc)Footnote 1. Figure 5a displays the correlation ρ between countries’ GTC in a certain year and their economic indexes after Δt years. One can see that ρ with GDP and GDP(PPP) is generally higher compared to that with GDPpc and GDP(PPP)pc. It also shows that ρ, in general, has a maximum value roughly 10 years later (Δt = 10) except the correlation to GDP(PPP). The high correlation between the economic indexes and GTC indicates that the prediction of economic growth can be applied to a simple linear regression model (Hidalgo and Hausmann, 2009). We give the range prediction under each bin of real growth as shown in Fig. 5b. The red labels are the prediction of G20 (except EU). The scatter plot of the predicted GDPpc growth and the real GDPpc growth exhibits a strong correlation. In fast-developing countries such as China and India, the actual growth rate is higher than predicted. In developed countries with slow growth such as the United States, Japan, and the United Kingdom, the predicted value is higher than the actual growth rate. Except these countries, We can still make good predictions for the countries like Russia, Canada, Australia, Turkey and others. More detailed discussion of the prediction power of GTC is given in SI7, Figs. S12 and S13. With regard to strengthening prediction power, this may require considering more factors or distinguishing different development models to predict economic growth.

Fig. 5: Predicting some representative economic indexes.
figure 5

a The correlation ρ between future economic index and the current global trade competitiveness (GTC). b Growth in GDP per capita(GDPpc) is predicted between 2000 and 2010. We give the range prediction under each bin of real growth. The red labels are the prediction of G20 (except EU).

Conclusions and discussions

The economic networks from massive data analysis, theory encompassing the appropriate description of economic agents and their interactions give a systemic understanding of global effects as a view of a single network like the monopartite product space network (Hidalgo et al., 2007; König et al., 2014) and the country-product bipartite network (Cristelli et al., 2015; Hartmann et al., 2017; Hausmann et al., 2014; Hidalgo and Hausmann, 2009; Tacchella et al., 2012). Although these works provide metrics that can quantify the economic complexity with the information of network structure, the networks they used overly simplify the international trading systems. As a remedy, we constructed a multilayer network in which the trading relations of each product are represented in the corresponding layer. We used the international trade datasets, which consist of both imports and exports relations to build multilayer world trade networks. We observed that each layer of the multilayer world trade network immediately revealed the nested structure in each layer and accordingly, which allowed us to develop a measure of the complexity of products. To validate the nestedness as a measure of product complexity, we compared the mean nestedness value of different types of products. The metric provided a ranking of products’ complexity more consistent with common understanding. The nested structure of a network layer seemed to correlate with the asymmetric export relations resulted from the technology barriers. We also used the nestedness to investigate the evolution of product complexity, and took the highest nested product types at different levels and observe the evolution of their average nestedness from 1986 to 2014. The evolution of product complexity indicated that the growth of product nestedness was faster than the relevance decay. Further, we remarked that the competitiveness of a country can also be measured based on the nestedness of the products exported and gave a comparison of trade competitive of countries between China and United States. Lastly, we extended nestedness index to predict a nation’s future economic growth.

Our work could bridge nestedness and economic complexity in multilayer world trade networks and enriches numerous extensions. As we have shown with our illustration of nested structure, which can characterize product complexity, we could bring solutions to other economic systems in observation and modeling. Especially, as we known, a lot of emerging trade barriers resulting from political conflict or a pandemic like the COVID-19, the nestedness could provide a way of thinking about the structural characteristics of the world trade data. Although, the aggregated nestedness index is trying to quantify the competitiveness of individual nations and forecast the collective evolution of the world economy, it is well worth mining. There also are other open questions to ask for future study. For instance, we mainly focus on the utilization of nestedness, but what are the mechanisms that lead to the substantially triangular structure of the matrix remains unclear. In addition, we just used a commonly adopted metric to measure the nestedness of a network. How to design a better metric to capture nestedness more accurately that is still worth studying. These similar issues have received substantial attention in socioeconomic systems, because it would be a solution for disentangling the conditions of global stability in socioeconomic systems when bursting perturbations and instability like financial crises, national bailouts and social events (Gao et al., 2016; Helbing, 2013; Saavedra et al., 2014; Schweitzer et al., 2009).