logo Netzschleuder network catalog, repository, and centrifuge

History of london_bikes

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 by Tiago de Paula Peixoto 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/london_bikes/__init__.py b/entries/london_bikes/__init__.py
index 8576680..0418fda 100644
--- a/entries/london_bikes/__init__.py
+++ b/entries/london_bikes/__init__.py
@@ -36,7 +36,7 @@ The network has the following properties:
 tags = ['Transportation', 'Travel', 'Multigraph', 'Timestamps', 'Metadata']
 url = 'https://github.com/konstantinklemmer/bikecommclust'
 citation = [('F. Munoz-Mendez, K. Han, K. Klemmer, S. Jarvis, "Community Structures, Interactions and Dynamics in London\'s Bicycle Sharing Network." Proceedings of the 2018 ACM International Joint Conference and 2018 International Symposium on Pervasive and Ubiquitous Computing and Wearable Computers (UbiComp \'18), 1015-1023 (2018)', 'https://doi.org/10.1145/3267305.3274156')]
-icon_hash = '5b4f78d9dfd5c2fc3b0716c0'
+date_added = '2026-10-25'
 upstream_license = None
 # Repository at a fixed commit
 upstream_prefix = 'https://raw.githubusercontent.com/konstantinklemmer/bikecommclust/6bfb8946e01e2aaf6ed7dca73bf7ccf7e6d7f2cb/data'
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto 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/london_bikes/__init__.py b/entries/london_bikes/__init__.py
index 510e7da..8576680 100644
--- a/entries/london_bikes/__init__.py
+++ b/entries/london_bikes/__init__.py
@@ -26,8 +26,13 @@ description = """A network of the trips made with the London bicycle sharing sch
 
 The network has the following properties:
 
-- Nodes: `station_id`, the TfL identifier of the station; `name`, the name of the station; `lat` and `lon`, its geographic coordinates (NaN for the few stations missing from the station list in the source repository, which was obtained from the TfL API some time after the trips).
-- Edges: `rental_id`, the identifier of the rental; `bike_id`, the identifier of the bicycle; `start` and `end`, the times of check-out and return (Unix timestamps, from London local times given to the minute); `duration`, the duration of the trip in seconds."""
+- (Node) `station_id`: the TfL identifier of the station.
+- (Node) `name`: the name of the station.
+- (Node) `lat` and `lon`: its geographic coordinates (NaN for the few stations missing from the station list in the source repository, which was obtained from the TfL API some time after the trips).
+- (Edge) `rental_id`: the identifier of the rental.
+- (Edge) `bike_id`: the identifier of the bicycle.
+- (Edge) `start` and `end`: the times of check-out and return (Unix timestamps, from London local times given to the minute).
+- (Edge) `duration`: the duration of the trip in seconds."""
 tags = ['Transportation', 'Travel', 'Multigraph', 'Timestamps', 'Metadata']
 url = 'https://github.com/konstantinklemmer/bikecommclust'
 citation = [('F. Munoz-Mendez, K. Han, K. Klemmer, S. Jarvis, "Community Structures, Interactions and Dynamics in London\'s Bicycle Sharing Network." Proceedings of the 2018 ACM International Joint Conference and 2018 International Symposium on Pervasive and Ubiquitous Computing and Wearable Computers (UbiComp \'18), 1015-1023 (2018)', 'https://doi.org/10.1145/3267305.3274156')]
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 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/london_bikes/__init__.py b/entries/london_bikes/__init__.py
index c92fb74..510e7da 100644
--- a/entries/london_bikes/__init__.py
+++ b/entries/london_bikes/__init__.py
@@ -45,7 +45,6 @@ def fetch_upstream(force=False):
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     name = __name__.split(".")[-1]
     tz = ZoneInfo("Europe/London")
     def ts(x):
[entries] New entry: london_bikes by Tiago de Paula Peixoto f0e2184
diff --git a/entries/london_bikes/__init__.py b/entries/london_bikes/__init__.py
new file mode 100644
index 0000000..c92fb74
--- /dev/null
+++ b/entries/london_bikes/__init__.py
@@ -0,0 +1,92 @@
+#! /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 *
+import datetime
+from zoneinfo import ZoneInfo
+
+title = "London bicycle sharing trips (2014)"
+description = """A network of the trips made with the London bicycle sharing scheme (Barclays Cycle Hire, now Santander Cycles) between 22 June and 31 July 2014, as compiled by Munoz-Mendez et al. from the Transport for London (TfL) Open Data. Each node is a docking station, and each directed edge is a trip, going from the station where a bicycle was checked out to the station where it was returned (trips that return to the same station are self-loops), so that the network is a multigraph with 1,469,851 trips between 750 stations.
+
+The network has the following properties:
+
+- Nodes: `station_id`, the TfL identifier of the station; `name`, the name of the station; `lat` and `lon`, its geographic coordinates (NaN for the few stations missing from the station list in the source repository, which was obtained from the TfL API some time after the trips).
+- Edges: `rental_id`, the identifier of the rental; `bike_id`, the identifier of the bicycle; `start` and `end`, the times of check-out and return (Unix timestamps, from London local times given to the minute); `duration`, the duration of the trip in seconds."""
+tags = ['Transportation', 'Travel', 'Multigraph', 'Timestamps', 'Metadata']
+url = 'https://github.com/konstantinklemmer/bikecommclust'
+citation = [('F. Munoz-Mendez, K. Han, K. Klemmer, S. Jarvis, "Community Structures, Interactions and Dynamics in London\'s Bicycle Sharing Network." Proceedings of the 2018 ACM International Joint Conference and 2018 International Symposium on Pervasive and Ubiquitous Computing and Wearable Computers (UbiComp \'18), 1015-1023 (2018)', 'https://doi.org/10.1145/3267305.3274156')]
+icon_hash = '5b4f78d9dfd5c2fc3b0716c0'
+upstream_license = None
+# Repository at a fixed commit
+upstream_prefix = 'https://raw.githubusercontent.com/konstantinklemmer/bikecommclust/6bfb8946e01e2aaf6ed7dca73bf7ccf7e6d7f2cb/data'
+files = [(('trips.zip:trips.csv', 'stations.csv'), None, 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]
+    tz = ZoneInfo("Europe/London")
+    def ts(x):
+        d = datetime.datetime.strptime(x, "%Y-%m-%d %H:%M:%S").replace(tzinfo=tz)
+        return int(d.timestamp())
+    for fnames, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        with ExitStack() as stack:
+            fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+            # Columns: "", Rental Id, Duration, Bike Id, End Date,
+            # EndStation Id, EndStation Name, Start Date, StartStation Id,
+            # StartStation Name
+            trips = list(csv.DictReader(fs[0]))
+            stations = {r["id"]: r for r in csv.DictReader(fs[1])}
+        g = Graph(directed=True)
+        g.vp.station_id = g.new_vp("int")
+        g.vp.name = g.new_vp("string")
+        g.vp.lat = g.new_vp("double")
+        g.vp.lon = g.new_vp("double")
+        vs = {}
+        def get_v(sid, sname):
+            v = vs.get(sid)
+            if v is None:
+                v = vs[sid] = g.add_vertex()
+                g.vp.station_id[v] = int(sid)
+                g.vp.name[v] = sname
+                s = stations.get(sid)
+                g.vp.lat[v] = float(s["lat"]) if s else numpy.nan
+                g.vp.lon[v] = float(s["long"]) if s else numpy.nan
+            return int(v)
+        edges = []
+        for r in trips:
+            edges.append((get_v(r["StartStation Id"], r["StartStation Name"]),
+                          get_v(r["EndStation Id"], r["EndStation Name"]),
+                          int(r["Rental Id"]), int(r["Bike Id"]),
+                          ts(r["Start Date"]), ts(r["End Date"]),
+                          int(r["Duration"])))
+        eprops = [("rental_id", "int"), ("bike_id", "int"), ("start", "int64_t"),
+                  ("end", "int64_t"), ("duration", "int")]
+        for p, t in eprops:
+            g.ep[p] = g.new_ep(t)
+        g.add_edge_list(edges, eprops=[g.ep[p] for p, t in eprops])
+        yield alt, g