logo Netzschleuder network catalog, repository, and centrifuge

History of india_bus_routes

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] Remove superfluous details of the upstream distribution from the descriptions by Tiago de Paula Peixoto dc07aa0
The descriptions mentioned incidental details of how the upstream data
are made available: the file formats (CSV, JSON, XML, GEXF, SBML, HIF,
Pajek, UCINET, ...), file names, where the files were published or
obtained from (Zenodo, figshare, Kaggle, the Pajek datasets page, the
Internet Archive), and that some networks are only available in the gt
format. These are left out; caveats about the data themselves are kept,
referring to "the data" instead of "the file". The description of
sp_baboons now lists its properties instead of the upstream columns,
and says that events without a recipient are left out.
diff --git a/entries/india_bus_routes/__init__.py b/entries/india_bus_routes/__init__.py
index f1bd6c5..253b31c 100644
--- a/entries/india_bus_routes/__init__.py
+++ b/entries/india_bus_routes/__init__.py
@@ -21,12 +21,12 @@ from .. import *
 title = "Bus networks of Indian cities (2016)"
 description = """Networks of the bus routes of six major Indian cities, compiled by A. Chatterjee, M. Manohar and G. Ramadurai from the route information published by the public bus operators: Ahmedabad Bus Rapid Transit System (`ahmedabad`), Metropolitan Transport Corporation, Chennai (`chennai`), Delhi Transport Corporation (`delhi`), Andhra Pradesh State Road Transport Corporation, Hyderabad (`hyderabad`), Calcutta State Transport Corporation, Kolkata (`kolkata`), and Brihanmumbai Electricity Supply and Transport, Mumbai (`mumbai`). Nodes are bus stops, and an undirected edge connects two stops that are consecutive on at least one bus route, with `weight` equal to the number of routes that overlap on that link (i.e. that serve the two stops in succession).
 
-In the source files the links are listed as source/target pairs. For Ahmedabad, Delhi and Kolkata, some pairs of stops are listed twice, once in each order and usually with different weights (presumably the numbers of routes in each travel direction); these are kept as parallel edges. Some links are self-loops. The authors treat the networks as undirected, as buses run in both directions.
+In the data, the links are given as ordered pairs. For Ahmedabad, Delhi and Kolkata, some pairs of stops are listed twice, once in each order and usually with different weights (presumably the numbers of routes in each travel direction); these are kept as parallel edges. Some links are self-loops. The authors treat the networks as undirected, as buses run in both directions.
 
 The networks have the following properties:
 
-- (Node) `name`: the name of the bus stop (`ahmedabad`, `delhi`, `hyderabad`, `kolkata`), or its numeric code (`chennai`, `mumbai`), as given in the source files.
-- (Edge) `weight`: the number of overlapping routes. One link of `delhi` has no weight in the source file, and has `weight` set to -1."""
+- (Node) `name`: the name of the bus stop (`ahmedabad`, `delhi`, `hyderabad`, `kolkata`), or its numeric code (`chennai`, `mumbai`), as given in the data.
+- (Edge) `weight`: the number of overlapping routes. One link of `delhi` has no weight in the data, and has `weight` set to -1."""
 tags = ['Transportation', 'Public Transport', 'Weighted', 'Multigraph', 'Metadata']
 url = 'https://github.com/achatterjee3/Dataset'
 citation = [('A. Chatterjee, M. Manohar, G. Ramadurai, "Statistical analysis of bus networks in India." PLoS ONE 11(12), e0168478 (2016)', 'https://doi.org/10.1371/journal.pone.0168478')]
[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/india_bus_routes/__init__.py b/entries/india_bus_routes/__init__.py
index f9f21ff..f1bd6c5 100644
--- a/entries/india_bus_routes/__init__.py
+++ b/entries/india_bus_routes/__init__.py
@@ -30,7 +30,7 @@ The networks have the following properties:
 tags = ['Transportation', 'Public Transport', 'Weighted', 'Multigraph', 'Metadata']
 url = 'https://github.com/achatterjee3/Dataset'
 citation = [('A. Chatterjee, M. Manohar, G. Ramadurai, "Statistical analysis of bus networks in India." PLoS ONE 11(12), e0168478 (2016)', 'https://doi.org/10.1371/journal.pone.0168478')]
-icon_hash = '595b1481549f067e0263b521'
+date_added = '2026-10-25'
 upstream_license = None
 upstream_prefix = 'https://raw.githubusercontent.com/achatterjee3/Dataset/master'
 files = [('bus_data:rar:Bus data/abn.txt', 'ahmedabad', None),
[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/india_bus_routes/__init__.py b/entries/india_bus_routes/__init__.py
index 8bacf54..f9f21ff 100644
--- a/entries/india_bus_routes/__init__.py
+++ b/entries/india_bus_routes/__init__.py
@@ -25,8 +25,8 @@ In the source files the links are listed as source/target pairs. For Ahmedabad,
 
 The networks have the following properties:
 
-- `name`: the name of the bus stop (`ahmedabad`, `delhi`, `hyderabad`, `kolkata`), or its numeric code (`chennai`, `mumbai`), as given in the source files.
-- `weight`: the number of overlapping routes. One link of `delhi` has no weight in the source file, and has `weight` set to -1."""
+- (Node) `name`: the name of the bus stop (`ahmedabad`, `delhi`, `hyderabad`, `kolkata`), or its numeric code (`chennai`, `mumbai`), as given in the source files.
+- (Edge) `weight`: the number of overlapping routes. One link of `delhi` has no weight in the source file, and has `weight` set to -1."""
 tags = ['Transportation', 'Public Transport', 'Weighted', 'Multigraph', 'Metadata']
 url = 'https://github.com/achatterjee3/Dataset'
 citation = [('A. Chatterjee, M. Manohar, G. Ramadurai, "Statistical analysis of bus networks in India." PLoS ONE 11(12), e0168478 (2016)', 'https://doi.org/10.1371/journal.pone.0168478')]
[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/india_bus_routes/__init__.py b/entries/india_bus_routes/__init__.py
index 75023ff..8bacf54 100644
--- a/entries/india_bus_routes/__init__.py
+++ b/entries/india_bus_routes/__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 fname, alt, fmt in files:
         if alts is not None and alt not in alts:
[entries] New entry: india_bus_routes by Tiago de Paula Peixoto 53b1a9d
diff --git a/entries/india_bus_routes/__init__.py b/entries/india_bus_routes/__init__.py
new file mode 100644
index 0000000..75023ff
--- /dev/null
+++ b/entries/india_bus_routes/__init__.py
@@ -0,0 +1,74 @@
+#! /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 = "Bus networks of Indian cities (2016)"
+description = """Networks of the bus routes of six major Indian cities, compiled by A. Chatterjee, M. Manohar and G. Ramadurai from the route information published by the public bus operators: Ahmedabad Bus Rapid Transit System (`ahmedabad`), Metropolitan Transport Corporation, Chennai (`chennai`), Delhi Transport Corporation (`delhi`), Andhra Pradesh State Road Transport Corporation, Hyderabad (`hyderabad`), Calcutta State Transport Corporation, Kolkata (`kolkata`), and Brihanmumbai Electricity Supply and Transport, Mumbai (`mumbai`). Nodes are bus stops, and an undirected edge connects two stops that are consecutive on at least one bus route, with `weight` equal to the number of routes that overlap on that link (i.e. that serve the two stops in succession).
+
+In the source files the links are listed as source/target pairs. For Ahmedabad, Delhi and Kolkata, some pairs of stops are listed twice, once in each order and usually with different weights (presumably the numbers of routes in each travel direction); these are kept as parallel edges. Some links are self-loops. The authors treat the networks as undirected, as buses run in both directions.
+
+The networks have the following properties:
+
+- `name`: the name of the bus stop (`ahmedabad`, `delhi`, `hyderabad`, `kolkata`), or its numeric code (`chennai`, `mumbai`), as given in the source files.
+- `weight`: the number of overlapping routes. One link of `delhi` has no weight in the source file, and has `weight` set to -1."""
+tags = ['Transportation', 'Public Transport', 'Weighted', 'Multigraph', 'Metadata']
+url = 'https://github.com/achatterjee3/Dataset'
+citation = [('A. Chatterjee, M. Manohar, G. Ramadurai, "Statistical analysis of bus networks in India." PLoS ONE 11(12), e0168478 (2016)', 'https://doi.org/10.1371/journal.pone.0168478')]
+icon_hash = '595b1481549f067e0263b521'
+upstream_license = None
+upstream_prefix = 'https://raw.githubusercontent.com/achatterjee3/Dataset/master'
+files = [('bus_data:rar:Bus data/abn.txt', 'ahmedabad', None),
+         ('bus_data:rar:Bus data/cbn.txt', 'chennai', None),
+         ('bus_data:rar:Bus data/dbn.txt', 'delhi', None),
+         ('bus_data:rar:Bus data/hbn.txt', 'hyderabad', None),
+         ('bus_data:rar:Bus data/kbn.txt', 'kolkata', None),
+         ('bus_data:rar:Bus data/mbn.txt', 'mumbai', None)]
+
+def fetch_upstream(force=False):
+    # The archive ("Bus data.rar") is stored as "bus_data"
+    return fetch_archived_files(__name__.split(".")[-1],
+                                {files[0][0]: upstream_prefix + '/Bus%20data.rar'},
+                                force)
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    name = __name__.split(".")[-1]
+    for fname, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        with open_upstream_file(name, fname, "rb") as f:
+            text = f.read().decode("utf-8-sig")
+        # One stop name of Hyderabad contains tab characters
+        text = text.replace("12\t.Road\t.Jubilee.Enclave", "12.Road.Jubilee.Enclave")
+        edges = []
+        for line in text.splitlines():
+            if not line.strip() or line.startswith("#"):
+                continue
+            row = line.split("\t")
+            w = row[2].strip() if len(row) > 2 else ""
+            edges.append((row[0].strip(), row[1].strip(),
+                          int(float(w)) if w else -1))
+        g = Graph(directed=False)
+        g.ep.weight = g.new_ep("int")
+        g.vp.name = g.add_edge_list(edges, hashed=True, hash_type="string",
+                                    eprops=[g.ep.weight])
+        yield alt, g