History of contiguous_usa
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] Lay out spatial networks with cfd_layout() without the SBM partition 9db8d77
Road, power grid, public transport, water and river networks and physical meshes override get_pos() with the default parameters of cfd_layout(), without grouping by the partition of the SBM fit.
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index 50f3419..fc7987b 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -53,3 +53,9 @@ def parse(alts=None):
g = Graph(directed=False)
g.vp.name = g.add_edge_list(edges, hashed=True, hash_type="string")
yield alt, g
+
+
+def get_pos(g, sbm_fit):
+ # Spatial network: laid out with the default parameters of cfd_layout(),
+ # without the partition of the SBM fit
+ return cfd_layout(g)
[entries] Move more KONECT-derived entries to their original sources bf9dc0e
The entries now download the data from where KONECT obtained them (live, or via the Wayback Machine), using the same release as KONECT where it is still available, and gain the metadata KONECT dropped; descriptions and citations are rewritten from the original sources: - Linton Freeman's UCINET data page: bible_nouns, bison, cattle, hens, highschool, kangaroo, macaques, moreno_sheep, physician_trust (the three relations and the physicians' attributes), rhesus_monkey, train_terrorists, windsurfers (now the networks `interaction` and `closeness`), college_freshmen, crime, interactome_yeast (from the primary source), moreno_taro (undirected), residence_hall, zebras - other pages, archived: contiguous_usa, advogato, google, github, digg_reply, twitter, bookcrossing, dbtropes_feature (without KONECT's spurious "ItemName" tropes) - movielens_100k (in fact the MovieLens 10M tag assignments) - dblp release 2017-05-02: dblp_author_paper, dblp_cite, dblp_coauthor - DBpedia 3.9: dbpedia_country, dbpedia_genre, dbpedia_location, dbpedia_occupation, dbpedia_producer, dbpedia_recordlabel, dbpedia_starring, dbpedia_team, dbpedia_writer, dbpedia_all, dbpedia_link - Discogs releases dump of October 2015: discogs_affiliation, discogs_genre and discogs_label (now with genre and style networks)
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index ba1eb41..50f3419 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -19,18 +19,24 @@
from .. import *
title = "Contiguous states (USA)"
-description = """A network of contiguous states in the USA, in which each state is a node and two nodes are connected if they share a land-based geographic border. The dataset includes the lower 48 states, and the District of Columbia.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+description = """A network of the 48 contiguous states of the USA and the District of Columbia, in which each node is a state (or the District of Columbia), and an edge connects two states that share a land border. The data were compiled by D. E. Knuth and distributed with the Stanford GraphBase as the "contiguous USA" graph used in *The Art of Computer Programming*. The two states not connected by land with the others (Alaska and Hawaii) are not included. The source does not document how borders meeting at a single point (e.g. the Four Corners of Arizona, Colorado, New Mexico and Utah) are treated; in the data, such diagonal pairs are not adjacent.
+
+The network has the following properties:
+
+- Nodes: `name`, the two-letter postal code of the state (DC for the District of Columbia)."""
tags = ['Transportation', 'Roads', 'Unweighted']
-url = 'http://konect.cc/networks/contiguous-usa'
-citation = [('D. Knuth, "The Stanford GraphBase: a platform for combinatorial computing”. Addison-Wesley Publishing Company (1993).', 'http://www-cs-faculty.stanford.edu/~uno/sgb.html')]
+url = 'https://www-cs-faculty.stanford.edu/~knuth/sgb.html'
+citation = [('D. E. Knuth, "The Stanford GraphBase: A Platform for Combinatorial Computing." ACM Press, New York (1993)', 'https://www-cs-faculty.stanford.edu/~knuth/sgb.html')]
icon_hash = '57f2da6c8cf714f319c3912a'
-upstream_prefix = 'http://konect.cc/files'
-files = [('download.tsv.contiguous-usa.tar.bz2', None, 'konect')]
+upstream_license = None
+# Knuth's site refuses connections from some hosts, so the file is obtained
+# from the Internet Archive.
+upstream_prefix = 'https://web.archive.org/web/20081025001104id_/http://www-cs-faculty.stanford.edu:80/~uno'
+files = [('contiguous-usa.dat', None, None)]
def fetch_upstream(force=False):
- return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
- force)
+ return retry_download(fetch_upstream_files, __name__.split(".")[-1],
+ upstream_prefix, files, force)
@cache_network()
@coerce_props()
@@ -38,12 +44,12 @@ def fetch_upstream(force=False):
def parse(alts=None):
global files
name = __name__.split(".")[-1]
- for fnames, alt, fmt in files:
+ for fname, 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, "rb")) for fn in fnames]
- g = parse_graph(fs, fmt, directed=False)
+ with open_upstream_file(name, fname, "r") as f:
+ # One border per line: "<state> <state>"
+ edges = [line.split() for line in f if line.strip()]
+ g = Graph(directed=False)
+ g.vp.name = g.add_edge_list(edges, hashed=True, hash_type="string")
yield alt, g
Update copyright information 73a4f0d
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index e73b1b0..ba1eb41 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__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/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index aecbec7..e73b1b0 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__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/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index b02cb36..aecbec7 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__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
Update copyright info db2efcc
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index 35a5f4e..b02cb36 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+# 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
Un-orphan KONECT datasets 894eba5
KONECT has been brought back from the dead for the time being.
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index c962d76..35a5f4e 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -26,7 +26,6 @@ url = 'http://konect.cc/networks/contiguous-usa'
citation = [('D. Knuth, "The Stanford GraphBase: a platform for combinatorial computing”. Addison-Wesley Publishing Company (1993).', 'http://www-cs-faculty.stanford.edu/~uno/sgb.html')]
icon_hash = '57f2da6c8cf714f319c3912a'
upstream_prefix = 'http://konect.cc/files'
-orphan = True
files = [('download.tsv.contiguous-usa.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Add support for 'orphan' datasets and tag konect entries e330b80
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index 35a5f4e..c962d76 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -26,6 +26,7 @@ url = 'http://konect.cc/networks/contiguous-usa'
citation = [('D. Knuth, "The Stanford GraphBase: a platform for combinatorial computing”. Addison-Wesley Publishing Company (1993).', 'http://www-cs-faculty.stanford.edu/~uno/sgb.html')]
icon_hash = '57f2da6c8cf714f319c3912a'
upstream_prefix = 'http://konect.cc/files'
+orphan = True
files = [('download.tsv.contiguous-usa.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index 1e28758..35a5f4e 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -3,18 +3,18 @@
#
# Copyright (C) 2020 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 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 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 General Public License for more details.
+# 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 General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# 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 *
Add explicit attribution to descriptions obtained from ICON 1645314
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
index 0bfd4b2..1e28758 100644
--- a/entries/contiguous_usa/__init__.py
+++ b/entries/contiguous_usa/__init__.py
@@ -19,7 +19,8 @@
from .. import *
title = "Contiguous states (USA)"
-description = "A network of contiguous states in the USA, in which each state is a node and two nodes are connected if they share a land-based geographic border. The dataset includes the lower 48 states, and the District of Columbia."
+description = """A network of contiguous states in the USA, in which each state is a node and two nodes are connected if they share a land-based geographic border. The dataset includes the lower 48 states, and the District of Columbia.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Transportation', 'Roads', 'Unweighted']
url = 'http://konect.cc/networks/contiguous-usa'
citation = [('D. Knuth, "The Stanford GraphBase: a platform for combinatorial computing”. Addison-Wesley Publishing Company (1993).', 'http://www-cs-faculty.stanford.edu/~uno/sgb.html')]
Initial commit cc85872
diff --git a/entries/contiguous_usa/__init__.py b/entries/contiguous_usa/__init__.py
new file mode 100644
index 0000000..0bfd4b2
--- /dev/null
+++ b/entries/contiguous_usa/__init__.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 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 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Contiguous states (USA)"
+description = "A network of contiguous states in the USA, in which each state is a node and two nodes are connected if they share a land-based geographic border. The dataset includes the lower 48 states, and the District of Columbia."
+tags = ['Transportation', 'Roads', 'Unweighted']
+url = 'http://konect.cc/networks/contiguous-usa'
+citation = [('D. Knuth, "The Stanford GraphBase: a platform for combinatorial computing”. Addison-Wesley Publishing Company (1993).', 'http://www-cs-faculty.stanford.edu/~uno/sgb.html')]
+icon_hash = '57f2da6c8cf714f319c3912a'
+upstream_prefix = 'http://konect.cc/files'
+files = [('download.tsv.contiguous-usa.tar.bz2', None, 'konect')]
+
+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, "rb")) for fn in fnames]
+ g = parse_graph(fs, fmt, directed=False)
+ yield alt, g