History of gb_public_transport
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 the spatial networks with hfd_layout() instead of cfd_layout() cc3bcb0
Changed: none
diff --git a/entries/gb_public_transport/__init__.py b/entries/gb_public_transport/__init__.py
index b00b3fc..d62fc55 100644
--- a/entries/gb_public_transport/__init__.py
+++ b/entries/gb_public_transport/__init__.py
@@ -71,6 +71,6 @@ def parse(alts=None):
def get_pos(g, sbm_fit):
- # Spatial network: laid out with the default parameters of cfd_layout(),
+ # Spatial network: laid out with the default parameters of hfd_layout(),
# without the partition of the SBM fit
- return cfd_layout(g)
+ return hfd_layout(g)
[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/gb_public_transport/__init__.py b/entries/gb_public_transport/__init__.py
index 01ce278..b00b3fc 100644
--- a/entries/gb_public_transport/__init__.py
+++ b/entries/gb_public_transport/__init__.py
@@ -32,7 +32,7 @@ The networks have the following properties:
tags = ['Transportation', 'Public Transport', 'Spatial', 'Unweighted', 'Metadata']
url = 'https://bitbucket.org/deregtr/gb_ptn'
citation = [('R. de Regt, C. von Ferber, Yu. Holovatch, M. Lebovka, "Public transportation in Great Britain viewed as a complex network." Transportmetrica A: Transport Science 15(2), 722-748 (2019)', 'https://doi.org/10.1080/23249935.2018.1529837')]
-icon_hash = '5be1b9003b0034c44569109f'
+date_added = '2026-10-25'
upstream_license = None
# Repository at a fixed commit
upstream_prefix = 'https://bitbucket.org/deregtr/gb_ptn/raw/3475dfefd4a85ec4bd4cb92df34153e84b52eaa4'
[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/gb_public_transport/__init__.py b/entries/gb_public_transport/__init__.py
index ef2850d..01ce278 100644
--- a/entries/gb_public_transport/__init__.py
+++ b/entries/gb_public_transport/__init__.py
@@ -27,7 +27,8 @@ description = """Public transport networks of Great Britain in 2011, constructed
The networks have the following properties:
-- Nodes: `station_id`, the unique station identifier of the NPTDR (the NaPTAN ATCO code); `pos`, the position of the station as Easting and Northing (British National Grid), in meters. The positions are missing (empty) for 31 stations of `london` and one of `bristol`. The `west_midlands` network contains 12 self-loops, as in the source data."""
+- (Node) `station_id`: the unique station identifier of the NPTDR (the NaPTAN ATCO code).
+- (Node) `pos`: the position of the station as Easting and Northing (British National Grid), in meters. The positions are missing (empty) for 31 stations of `london` and one of `bristol`. The `west_midlands` network contains 12 self-loops, as in the source data."""
tags = ['Transportation', 'Public Transport', 'Spatial', 'Unweighted', 'Metadata']
url = 'https://bitbucket.org/deregtr/gb_ptn'
citation = [('R. de Regt, C. von Ferber, Yu. Holovatch, M. Lebovka, "Public transportation in Great Britain viewed as a complex network." Transportmetrica A: Transport Science 15(2), 722-748 (2019)', 'https://doi.org/10.1080/23249935.2018.1529837')]
[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/gb_public_transport/__init__.py b/entries/gb_public_transport/__init__.py
index a3cf64b..ef2850d 100644
--- a/entries/gb_public_transport/__init__.py
+++ b/entries/gb_public_transport/__init__.py
@@ -50,7 +50,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] 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/gb_public_transport/__init__.py b/entries/gb_public_transport/__init__.py
index d9bb190..a3cf64b 100644
--- a/entries/gb_public_transport/__init__.py
+++ b/entries/gb_public_transport/__init__.py
@@ -68,3 +68,9 @@ def parse(alts=None):
if len(vals) == 3 and vals[0] in idx:
g.vp.pos[idx[vals[0]]] = [float(vals[1]), float(vals[2])]
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] New entry: gb_public_transport 80b0c6d
diff --git a/entries/gb_public_transport/__init__.py b/entries/gb_public_transport/__init__.py
new file mode 100644
index 0000000..d9bb190
--- /dev/null
+++ b/entries/gb_public_transport/__init__.py
@@ -0,0 +1,70 @@
+#! /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 = "Great Britain public transport networks (2011)"
+description = """Public transport networks of Great Britain in 2011, constructed by de Regt, von Ferber, Holovatch and Lebovka from the timetables of the National Public Transport Data Repository (NPTDR) of the UK Department for Transport, which contains a snapshot of all public transport services for a sample week (usually in early October) of each year. The networks are in the so-called L-space representation: nodes are stations (stops), and an undirected edge connects two stations if they are visited consecutively by a vehicle on some route. Only outgoing routes were considered, and multiple edges were reduced to single ones.
+
+- `bristol`, `london`, `manchester`, `west_midlands`: the bus networks of Bristol, Greater London, Greater Manchester and the West Midlands.
+- `coach`: the national coach network.
+- `rail`: the national rail network.
+
+The networks have the following properties:
+
+- Nodes: `station_id`, the unique station identifier of the NPTDR (the NaPTAN ATCO code); `pos`, the position of the station as Easting and Northing (British National Grid), in meters. The positions are missing (empty) for 31 stations of `london` and one of `bristol`. The `west_midlands` network contains 12 self-loops, as in the source data."""
+tags = ['Transportation', 'Public Transport', 'Spatial', 'Unweighted', 'Metadata']
+url = 'https://bitbucket.org/deregtr/gb_ptn'
+citation = [('R. de Regt, C. von Ferber, Yu. Holovatch, M. Lebovka, "Public transportation in Great Britain viewed as a complex network." Transportmetrica A: Transport Science 15(2), 722-748 (2019)', 'https://doi.org/10.1080/23249935.2018.1529837')]
+icon_hash = '5be1b9003b0034c44569109f'
+upstream_license = None
+# Repository at a fixed commit
+upstream_prefix = 'https://bitbucket.org/deregtr/gb_ptn/raw/3475dfefd4a85ec4bd4cb92df34153e84b52eaa4'
+files = [(('edges_bristol.dat', 'co_Bristol.dat'), 'bristol', None),
+ (('edges_london.dat', 'co_London.dat'), 'london', None),
+ (('edges_man.dat', 'co_Manchester.dat'), 'manchester', None),
+ (('edges_wm.dat', 'co_WM.dat'), 'west_midlands', None),
+ (('edges_coach.dat', 'co_Coach.dat'), 'coach', None),
+ (('edges_rail.dat', 'co_Rail.dat'), 'rail', 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
+ with open_upstream_file(name, fnames[0], "r") as f:
+ edges = [line.split() for line in f if line.strip()]
+ g = Graph(directed=False)
+ g.vp.station_id = g.add_edge_list(edges, hashed=True,
+ hash_type="string")
+ idx = {g.vp.station_id[v]: int(v) for v in g.vertices()}
+ g.vp.pos = g.new_vp("vector<double>")
+ with open_upstream_file(name, fnames[1], "r") as f:
+ for line in f:
+ vals = line.split()
+ if len(vals) == 3 and vals[0] in idx:
+ g.vp.pos[idx[vals[0]]] = [float(vals[1]), float(vals[2])]
+ yield alt, g