History of us_airports
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/us_airports/__init__.py b/entries/us_airports/__init__.py
index ee71f34..dde00a2 100644
--- a/entries/us_airports/__init__.py
+++ b/entries/us_airports/__init__.py
@@ -34,7 +34,7 @@ tags = ['Transportation', 'Airport', 'Weighted']
url = 'https://toreopsahl.com/datasets/#usairports'
citation = [('V. Colizza, R. Pastor-Satorras, A. Vespignani, "Reaction-diffusion processes and metapopulation models in heterogeneous networks." Nature Physics 3, 276-282 (2007)', 'https://doi.org/10.1038/nphys560'),
('T. Opsahl, "Why Anchorage is not (that) important: Binary ties and sample selection" (2011)', 'https://toreopsahl.com/2011/08/12/why-anchorage-is-not-that-important-binary-ties-and-sample-selection/')]
-icon_hash = ['56a85c8e26855e083a2f78e4', '56a85c8e26855e083a2f78e5']
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'http://opsahl.co.uk/tnet/datasets'
files = [('USairport500.txt', 'top500_2002', 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/us_airports/__init__.py b/entries/us_airports/__init__.py
index 7386092..ee71f34 100644
--- a/entries/us_airports/__init__.py
+++ b/entries/us_airports/__init__.py
@@ -27,8 +27,9 @@ description = """Two networks of flights among airports in the United States, di
The networks have the following properties:
-- `top500_2002`: Edges: `weight`, the number of seats available on the scheduled flights between the two airports in 2002.
-- `bts_2010`: Nodes: `name`, the airport code (IATA/FAA). Edges: `weight`, the total number of passengers flown from airport i to airport j in 2010."""
+- (Edge) `weight` (`top500_2002`): the number of seats available on the scheduled flights between the two airports in 2002.
+- (Node) `name` (`bts_2010`): the airport code (IATA/FAA).
+- (Edge) `weight` (`bts_2010`): the total number of passengers flown from airport i to airport j in 2010."""
tags = ['Transportation', 'Airport', 'Weighted']
url = 'https://toreopsahl.com/datasets/#usairports'
citation = [('V. Colizza, R. Pastor-Satorras, A. Vespignani, "Reaction-diffusion processes and metapopulation models in heterogeneous networks." Nature Physics 3, 276-282 (2007)', 'https://doi.org/10.1038/nphys560'),
[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/us_airports/__init__.py b/entries/us_airports/__init__.py
index 74f3a50..7386092 100644
--- a/entries/us_airports/__init__.py
+++ b/entries/us_airports/__init__.py
@@ -47,7 +47,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] New entry: us_airports 4c0c836
diff --git a/entries/us_airports/__init__.py b/entries/us_airports/__init__.py
new file mode 100644
index 0000000..74f3a50
--- /dev/null
+++ b/entries/us_airports/__init__.py
@@ -0,0 +1,81 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# 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
+# 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 = "US airport networks (2002, 2010)"
+description = """Two networks of flights among airports in the United States, distributed by T. Opsahl.
+
+- `top500_2002`: the 500 busiest commercial airports in the United States, connected if a flight was scheduled between them in 2002. This network was used by Colizza, Pastor-Satorras and Vespignani (2007), and was obtained by Opsahl from the website of the Complex Networks Collaboratory. Although flights are directed, the network is nearly symmetric, and is provided in undirected form. The airports are anonymized.
+- `bts_2010`: all airports in the United States (and airports abroad with flights to or from them), connected by flights in 2010, according to the T-100 table of the Bureau of Transportation Statistics (BTS) Transtats website (with all geographies and months of 2010, and the columns passengers, origin and destination). Flights between the same airports were aggregated, links with zero passengers (cargo only) and self-loops were removed. A directed edge (i, j) indicates passengers flown from airport i to airport j.
+
+The networks have the following properties:
+
+- `top500_2002`: Edges: `weight`, the number of seats available on the scheduled flights between the two airports in 2002.
+- `bts_2010`: Nodes: `name`, the airport code (IATA/FAA). Edges: `weight`, the total number of passengers flown from airport i to airport j in 2010."""
+tags = ['Transportation', 'Airport', 'Weighted']
+url = 'https://toreopsahl.com/datasets/#usairports'
+citation = [('V. Colizza, R. Pastor-Satorras, A. Vespignani, "Reaction-diffusion processes and metapopulation models in heterogeneous networks." Nature Physics 3, 276-282 (2007)', 'https://doi.org/10.1038/nphys560'),
+ ('T. Opsahl, "Why Anchorage is not (that) important: Binary ties and sample selection" (2011)', 'https://toreopsahl.com/2011/08/12/why-anchorage-is-not-that-important-binary-ties-and-sample-selection/')]
+icon_hash = ['56a85c8e26855e083a2f78e4', '56a85c8e26855e083a2f78e5']
+upstream_license = None
+upstream_prefix = 'http://opsahl.co.uk/tnet/datasets'
+files = [('USairport500.txt', 'top500_2002', None),
+ (('USairport_2010.txt', 'USairport_2010_codes.txt'), 'bts_2010', 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]
+ # some weights are written in scientific notation (e.g. 1e+05)
+ edges = numpy.loadtxt(fs[0]).round().astype("int")
+ edges[:, :2] -= 1
+ if alt == "top500_2002":
+ g = Graph(directed=False)
+ g.add_vertex(edges[:, :2].max() + 1)
+ # each tie is listed in both directions, with the same weight
+ edges = edges[edges[:, 0] < edges[:, 1]]
+ else:
+ codes = [line.split(None, 1) for line in fs[1] if line.strip()]
+ g = Graph(directed=True)
+ g.add_vertex(len(codes))
+ g.vp.name = g.new_vp("string")
+ for i, c in codes:
+ g.vp.name[int(i) - 1] = c.strip().strip('"')
+ g.ep.weight = g.new_ep("int")
+ g.add_edge_list(edges, eprops=[g.ep.weight])
+ if alt == "bts_2010":
+ # keep only the airports with flights in 2010
+ g = GraphView(g, vfilt=g.get_total_degrees(g.get_vertices()) > 0)
+ g = Graph(g, prune=True)
+ yield alt, g