History of grassland_web
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/grassland_web/__init__.py b/entries/grassland_web/__init__.py
index 248aef5..7c5bee2 100644
--- a/entries/grassland_web/__init__.py
+++ b/entries/grassland_web/__init__.py
@@ -32,7 +32,7 @@ tags = ['Biological', 'Food web', 'Unweighted', 'Metadata']
url = 'https://aaronclauset.github.io/datacode.htm'
citation = [('H. A. Dawah, B. A. Hawkins, M. F. Claridge, "Structure of the parasitoid communities of grass-feeding chalcid wasps." Journal of Animal Ecology 64(6), 708-720 (1995)', 'https://doi.org/10.2307/5850'),
('A. Clauset, C. Moore, M. E. J. Newman, "Hierarchical structure and the prediction of missing links in networks." Nature 453, 98-101 (2008)', 'https://doi.org/10.1038/nature06830')]
-icon_hash = '56a85c8e26855e083a2f7926'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://aaronclauset.github.io/hierarchy'
files = [(('grass_web.zip:grass_web/grass_web.pairs',
[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/grassland_web/__init__.py b/entries/grassland_web/__init__.py
index a443b2b..248aef5 100644
--- a/entries/grassland_web/__init__.py
+++ b/entries/grassland_web/__init__.py
@@ -26,8 +26,8 @@ A directed edge $(i, j)$ indicates that species $i$ feeds on (or parasitizes) sp
The network has the following properties:
-- `id`: the node number in the source data (not contiguous).
-- `group`: the trophic group of the species (1: plants, 2: herbivores, 3: parasitoids, 4: hyper-parasitoids, 5: hyper-hyper-parasitoids), as given by Clauset, Moore and Newman (2008)."""
+- (Node) `id`: the node number in the source data (not contiguous).
+- (Node) `group`: the trophic group of the species (1: plants, 2: herbivores, 3: parasitoids, 4: hyper-parasitoids, 5: hyper-hyper-parasitoids), as given by Clauset, Moore and Newman (2008)."""
tags = ['Biological', 'Food web', 'Unweighted', 'Metadata']
url = 'https://aaronclauset.github.io/datacode.htm'
citation = [('H. A. Dawah, B. A. Hawkins, M. F. Claridge, "Structure of the parasitoid communities of grass-feeding chalcid wasps." Journal of Animal Ecology 64(6), 708-720 (1995)', 'https://doi.org/10.2307/5850'),
[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/grassland_web/__init__.py b/entries/grassland_web/__init__.py
index e13320e..a443b2b 100644
--- a/entries/grassland_web/__init__.py
+++ b/entries/grassland_web/__init__.py
@@ -46,7 +46,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: grassland_web a5af221
diff --git a/entries/grassland_web/__init__.py b/entries/grassland_web/__init__.py
new file mode 100644
index 0000000..e13320e
--- /dev/null
+++ b/entries/grassland_web/__init__.py
@@ -0,0 +1,73 @@
+#! /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 = "Grassland host-parasitoid food web (1995)"
+description = r"""A food web of grassland species, consisting of grasses, the grass-feeding chalcid wasps (herbivores) that feed on them, and the parasitoids and hyper-parasitoids of these wasps, compiled by H. A. Dawah, B. A. Hawkins and M. F. Claridge (1995) from field collections in Britain (Wales and England, 1980-1992, according to the ICON index). This version was distributed by A. Clauset, who used it as an example of hierarchical network structure; according to ICON, it contains only the largest connected component of the sampled web. Species names are not included.
+
+A directed edge $(i, j)$ indicates that species $i$ feeds on (or parasitizes) species $j$.
+
+The network has the following properties:
+
+- `id`: the node number in the source data (not contiguous).
+- `group`: the trophic group of the species (1: plants, 2: herbivores, 3: parasitoids, 4: hyper-parasitoids, 5: hyper-hyper-parasitoids), as given by Clauset, Moore and Newman (2008)."""
+tags = ['Biological', 'Food web', 'Unweighted', 'Metadata']
+url = 'https://aaronclauset.github.io/datacode.htm'
+citation = [('H. A. Dawah, B. A. Hawkins, M. F. Claridge, "Structure of the parasitoid communities of grass-feeding chalcid wasps." Journal of Animal Ecology 64(6), 708-720 (1995)', 'https://doi.org/10.2307/5850'),
+ ('A. Clauset, C. Moore, M. E. J. Newman, "Hierarchical structure and the prediction of missing links in networks." Nature 453, 98-101 (2008)', 'https://doi.org/10.1038/nature06830')]
+icon_hash = '56a85c8e26855e083a2f7926'
+upstream_license = None
+upstream_prefix = 'https://aaronclauset.github.io/hierarchy'
+files = [(('grass_web.zip:grass_web/grass_web.pairs',
+ 'grass_web.zip:grass_web/grass_web.groups'), 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]
+ 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, "rb"))
+ for fn in fnames]
+ pairs = [[int(x) for x in line.split()]
+ for line in fs[0].read().decode().splitlines() if line.strip()]
+ # the groups file has old Mac (CR) line endings
+ groups = [[int(x) for x in line.split()]
+ for line in fs[1].read().decode().replace("\r", "\n").splitlines()
+ if line.strip()]
+ g = Graph(directed=True)
+ g.vp.id = g.new_vp("int")
+ g.vp.group = g.new_vp("int")
+ vs = {}
+ for i, grp in groups:
+ v = vs[i] = g.add_vertex()
+ g.vp.id[v] = i
+ g.vp.group[v] = grp
+ for i, j in pairs:
+ g.add_edge(vs[i], vs[j])
+ yield alt, g