History of product_space
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index a926b16..9733b72 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -39,7 +39,7 @@ citation = [('R. Hausmann et al., "The Atlas of Economic Complexity: Mapping pat
('C. A. Hidalgo, B. Klinger, A.-L. Barabási, R. Hausmann, "The Product Space Conditions the Development of Nations", Science 317(5837), 482-487 (2007)', 'https://doi.org/10.1126/science.1144581'),
('CA Hidalgo, R Hausmann, "The Building Blocks of Economic Complexity", Proc. Natl. Acad. Sci. 106(26):10570-10575 (2009)', "https://doi.org/10.1073/pnas.0900943106"),
('R Hausmann, CA Hidalgo, S Bustos, M Coscia, S Chung, J Jimenez, A Simoes, MA Yildirim, "The Atlas of Economic Complexity", Puritan Press (2011). ISBN-10: 0615546625', 'http://atlas.media.mit.edu/book/')]
-icon_hash = '577e7bf458d31bd664bac0d9'
+date_added = '2021-12-25'
upstream_license = None
upstream_prefix = 'http://www.michelecoscia.com/wp-content/uploads/2012/09/'
files = [(('PS_HS.zip:PS_HS_nodes', 'PS_HS.zip:PS_HS_edges'), 'HS', None),
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index 10d543e..a926b16 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -25,14 +25,14 @@ There are two networks, using different product classifications at the 4-digit l
The networks have the following properties:
-- `pid`: the 4-digit product code (SITC or HS).
-- `community`: the product community (cluster of related products) in the source data, which determines the color of the node.
-- `pos`: the $(x,y)$ coordinates of the product in the layout of the visualization.
-- `size`: the node size in the visualization, which reflects the product's share of world trade, but not linearly.
-- `leamer` (`SITC` only): the Leamer category of the product (a grouping of products into 10 categories by factor intensity).
-- `name`: the name of the product.
-- `color`: the color of the node in the visualization, which corresponds to the product community.
-- `width`, `color` (edges): the width and color of the edge in the visualization, which reflect the strength of the link (proximity), but not linearly."""
+- (Node) `pid`: the 4-digit product code (SITC or HS).
+- (Node) `community`: the product community (cluster of related products) in the source data, which determines the color of the node.
+- (Node) `pos`: the $(x,y)$ coordinates of the product in the layout of the visualization.
+- (Node) `size`: the node size in the visualization, which reflects the product's share of world trade, but not linearly.
+- (Node) `leamer` (`SITC` only): the Leamer category of the product (a grouping of products into 10 categories by factor intensity).
+- (Node) `name`: the name of the product.
+- (Node) `color`: the color of the node in the visualization, which corresponds to the product community.
+- (Edge) `width`, `color`: the width and color of the edge in the visualization, which reflect the strength of the link (proximity), but not linearly."""
tags = ['Economic', 'Trade', 'Weighted', 'Projection', 'Metadata']
url = 'http://www.michelecoscia.com/?page_id=223'
citation = [('R. Hausmann et al., "The Atlas of Economic Complexity: Mapping paths to prosperity." MIT Press (2014)', 'https://doi.org/10.7551/mitpress/9647.001.0001'),
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index c8d0e13..10d543e 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -53,7 +53,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] Fix parse bugs and improve the metadata of existing entries c996a0e
From a review of the dataset descriptions against the upstream sources and papers, and from user reports: - parse fixes (wrong edge direction or directedness, shifted or misnamed properties, merged node identities, duplicated or missing edges and nodes, wrong types), e.g. arxiv_citation (the HepTh dates were a copy of the HepPh ones; now from the KDD Cup 2003 data), eu_procurements, foursquare_global, hiv_transmission, genetic_multiplex, gnutella (adds the 05 snapshot), roadnet, macaque_neural, python_dependency - descriptions rewritten from the upstream sources, documenting every property - corrected titles, citations and DOIs, licences (ustream_license typo, the data's own terms), tags and ICON ids - url lists for entries with several sources or dataset pages - SocioPatterns entries moved to the site's new data location, with the daily networks of sp_infectious and sp_primary_school - the Michael Fire entries marked as orphans (served from the mirror) - redundant type forcings removed after the graph-tool coercion fixes
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index 3949c11..c8d0e13 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -19,15 +19,28 @@
from .. import *
title = "Atlas of Economic Complexity export network"
-description = """Two networks of economic products, where a pair of products are connected if they are exported at similar rates by the same countries. The data are a projection from a bipartite network of nations and the products they export. Edges weights represent a similarity score (called \"proximity\"). Data based on UN Comtrade worldwide trade patterns. SITC network based on the Standard International Trade Classification and HS network based on the Harmonized Commodity Description and Coding System.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+description = r"""The "product space", a network of products in world trade, as visualized in the Atlas of Economic Complexity (R. Hausmann, C. A. Hidalgo et al.), and distributed by M. Coscia. Nodes are products, and edges connect products that tend to be exported together by the same countries, based on the UN Comtrade data on world trade. The relatedness of two products $i$ and $j$ is measured by their proximity, $\phi_{ij} = \min\{P(x_i|x_j), P(x_j|x_i)\}$, where $P(x_i|x_j)$ is the conditional probability that a country exports product $i$ with revealed comparative advantage (i.e. a share of its exports larger than the share of the product in world trade), given that it does so for product $j$. The networks are not the full proximity matrix, but the sparse backbones used for visualizing it, which consist of the strongest links (in Hidalgo et al., Science 317, 482 (2007), the maximum spanning tree of the proximity network plus the links with the highest proximity). Edges are undirected.
+
+There are two networks, using different product classifications at the 4-digit level: `SITC`, based on the Standard International Trade Classification, and `HS`, based on the Harmonized Commodity Description and Coding System.
+
+The networks have the following properties:
+
+- `pid`: the 4-digit product code (SITC or HS).
+- `community`: the product community (cluster of related products) in the source data, which determines the color of the node.
+- `pos`: the $(x,y)$ coordinates of the product in the layout of the visualization.
+- `size`: the node size in the visualization, which reflects the product's share of world trade, but not linearly.
+- `leamer` (`SITC` only): the Leamer category of the product (a grouping of products into 10 categories by factor intensity).
+- `name`: the name of the product.
+- `color`: the color of the node in the visualization, which corresponds to the product community.
+- `width`, `color` (edges): the width and color of the edge in the visualization, which reflect the strength of the link (proximity), but not linearly."""
tags = ['Economic', 'Trade', 'Weighted', 'Projection', 'Metadata']
url = 'http://www.michelecoscia.com/?page_id=223'
-citation = [('R. Hausmann et al., "The Atlas of Economic Complexity: Mapping paths to prosperity." MIT Press (2014)', 'https://doi.org/10.1126/science.1144581'),
+citation = [('R. Hausmann et al., "The Atlas of Economic Complexity: Mapping paths to prosperity." MIT Press (2014)', 'https://doi.org/10.7551/mitpress/9647.001.0001'),
+ ('C. A. Hidalgo, B. Klinger, A.-L. Barabási, R. Hausmann, "The Product Space Conditions the Development of Nations", Science 317(5837), 482-487 (2007)', 'https://doi.org/10.1126/science.1144581'),
('CA Hidalgo, R Hausmann, "The Building Blocks of Economic Complexity", Proc. Natl. Acad. Sci. 106(26):10570-10575 (2009)', "https://doi.org/10.1073/pnas.0900943106"),
('R Hausmann, CA Hidalgo, S Bustos, M Coscia, S Chung, J Jimenez, A Simoes, MA Yildirim, "The Atlas of Economic Complexity", Puritan Press (2011). ISBN-10: 0615546625', 'http://atlas.media.mit.edu/book/')]
icon_hash = '577e7bf458d31bd664bac0d9'
-ustream_license = None
+upstream_license = None
upstream_prefix = 'http://www.michelecoscia.com/wp-content/uploads/2012/09/'
files = [(('PS_HS.zip:PS_HS_nodes', 'PS_HS.zip:PS_HS_edges'), 'HS', None),
(('PS_SITC.zip:PS_SITC_nodes', 'PS_SITC.zip:PS_SITC_edges'), 'SITC', None)]
@@ -56,31 +69,32 @@ def parse(alts=None):
g.vp.community = g.new_vp("int")
g.vp.size = g.new_vp("double")
g.vp.pos = g.new_vp("vector<double>")
- g.vp.leamer = g.new_vp("string")
- g.vp.name = g.new_vp("string")
if alt == "SITC":
- g.vp.color = g.new_vp("string")
+ g.vp.leamer = g.new_vp("string")
+ g.vp.name = g.new_vp("string")
+ g.vp.color = g.new_vp("string")
vertices = {}
for line in fs[0]:
v = g.add_vertex()
if alt == "SITC":
- pid, c, x, y, s, leamer, name, color = line.split("\t")
- g.vp.color[v] = color
+ pid, c, x, y, s, leamer, pname, color = line.rstrip("\n").split("\t")
+ g.vp.leamer[v] = leamer
else:
- pid, c, x, y, s, leamer, name = line.split("\t")
+ pid, c, x, y, s, pname, color = line.rstrip("\n").split("\t")
+ g.vp.color[v] = color
+ g.vp.community[v] = int(c)
g.vp.pid[v] = int(pid)
vertices[int(pid)] = v
g.vp.pos[v] = [float(x), float(y)]
g.vp.size[v] = s
- g.vp.name[v] = name
- g.vp.leamer[v] = leamer
+ g.vp.name[v] = pname
g.ep.width = g.new_ep("double")
g.ep.color = g.new_ep("string")
for line in fs[1]:
- s, x_s, y_s, t, x_t, y_t, w, c = line.split("\t")
+ s, x_s, y_s, t, x_t, y_t, w, c = line.rstrip("\n").split("\t")
s = vertices[int(s)]
t = vertices[int(t)]
Update copyright information 73a4f0d
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index 011c2fa..3949c11 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Update copyright information 3d288ea
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index 9cb8629..011c2fa 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Update copyright information 8d005ae
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
index 34510f5..9cb8629 100644
--- a/entries/product_space/__init__.py
+++ b/entries/product_space/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
Add entry 'product_space' e671ead
diff --git a/entries/product_space/__init__.py b/entries/product_space/__init__.py
new file mode 100644
index 0000000..34510f5
--- /dev/null
+++ b/entries/product_space/__init__.py
@@ -0,0 +1,91 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Atlas of Economic Complexity export network"
+description = """Two networks of economic products, where a pair of products are connected if they are exported at similar rates by the same countries. The data are a projection from a bipartite network of nations and the products they export. Edges weights represent a similarity score (called \"proximity\"). Data based on UN Comtrade worldwide trade patterns. SITC network based on the Standard International Trade Classification and HS network based on the Harmonized Commodity Description and Coding System.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+tags = ['Economic', 'Trade', 'Weighted', 'Projection', 'Metadata']
+url = 'http://www.michelecoscia.com/?page_id=223'
+citation = [('R. Hausmann et al., "The Atlas of Economic Complexity: Mapping paths to prosperity." MIT Press (2014)', 'https://doi.org/10.1126/science.1144581'),
+ ('CA Hidalgo, R Hausmann, "The Building Blocks of Economic Complexity", Proc. Natl. Acad. Sci. 106(26):10570-10575 (2009)', "https://doi.org/10.1073/pnas.0900943106"),
+ ('R Hausmann, CA Hidalgo, S Bustos, M Coscia, S Chung, J Jimenez, A Simoes, MA Yildirim, "The Atlas of Economic Complexity", Puritan Press (2011). ISBN-10: 0615546625', 'http://atlas.media.mit.edu/book/')]
+icon_hash = '577e7bf458d31bd664bac0d9'
+ustream_license = None
+upstream_prefix = 'http://www.michelecoscia.com/wp-content/uploads/2012/09/'
+files = [(('PS_HS.zip:PS_HS_nodes', 'PS_HS.zip:PS_HS_edges'), 'HS', None),
+ (('PS_SITC.zip:PS_SITC_nodes', 'PS_SITC.zip:PS_SITC_edges'), 'SITC', None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ if isinstance(fnames, str):
+ fnames = [fnames]
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+
+ g = Graph(directed=False)
+
+ g.vp.pid = g.new_vp("int")
+ g.vp.community = g.new_vp("int")
+ g.vp.size = g.new_vp("double")
+ g.vp.pos = g.new_vp("vector<double>")
+ g.vp.leamer = g.new_vp("string")
+ g.vp.name = g.new_vp("string")
+ if alt == "SITC":
+ g.vp.color = g.new_vp("string")
+
+ vertices = {}
+ for line in fs[0]:
+ v = g.add_vertex()
+ if alt == "SITC":
+ pid, c, x, y, s, leamer, name, color = line.split("\t")
+ g.vp.color[v] = color
+ else:
+ pid, c, x, y, s, leamer, name = line.split("\t")
+ g.vp.pid[v] = int(pid)
+ vertices[int(pid)] = v
+ g.vp.pos[v] = [float(x), float(y)]
+ g.vp.size[v] = s
+ g.vp.name[v] = name
+ g.vp.leamer[v] = leamer
+
+ g.ep.width = g.new_ep("double")
+ g.ep.color = g.new_ep("string")
+
+ for line in fs[1]:
+ s, x_s, y_s, t, x_t, y_t, w, c = line.split("\t")
+
+ s = vertices[int(s)]
+ t = vertices[int(t)]
+ e = g.add_edge(s, t)
+ g.ep.width[e] = w
+ g.ep.color[e] = c
+
+ yield alt, g