History of harry_potter_support
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/harry_potter_support/__init__.py b/entries/harry_potter_support/__init__.py
index cf27692..821bfbc 100644
--- a/entries/harry_potter_support/__init__.py
+++ b/entries/harry_potter_support/__init__.py
@@ -34,7 +34,7 @@ The networks have the following properties:
tags = ['Social', 'Fictional', 'Unweighted', 'Metadata', 'Temporal']
url = 'https://www.stats.ox.ac.uk/~snijders/siena/HarryPotterData.html'
citation = [('G. Bossaert, N. Meidert, "\'We are only as strong as we are united, as weak as we are divided\'. A dynamic analysis of the peer support networks in the Harry Potter books." Open Journal of Applied Sciences 3(2), 174-185 (2013)', 'https://doi.org/10.4236/ojapps.2013.32024')]
-icon_hash = '5944abe54ed8f1bb6022a49d'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://www.stats.ox.ac.uk/~snijders/siena'
z = 'bossaert_meidert_harrypotter.zip:'
[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/harry_potter_support/__init__.py b/entries/harry_potter_support/__init__.py
index 00808aa..cf27692 100644
--- a/entries/harry_potter_support/__init__.py
+++ b/entries/harry_potter_support/__init__.py
@@ -26,7 +26,11 @@ A directed edge (i, j) in network `bookN` indicates that student i supported stu
The networks have the following properties:
-- Nodes: `name`, the name of the character; `schoolyear`, the year the student entered Hogwarts; `gender` (1: male, 2: female); `house` (1: Gryffindor, 2: Hufflepuff, 3: Ravenclaw, 4: Slytherin); `present`, whether the student attended Hogwarts during the book, according to the composition change file of the data set."""
+- (Node) `name`: the name of the character.
+- (Node) `schoolyear`: the year the student entered Hogwarts.
+- (Node) `gender` (1: male, 2: female).
+- (Node) `house` (1: Gryffindor, 2: Hufflepuff, 3: Ravenclaw, 4: Slytherin).
+- (Node) `present`: whether the student attended Hogwarts during the book, according to the composition change file of the data set."""
tags = ['Social', 'Fictional', 'Unweighted', 'Metadata', 'Temporal']
url = 'https://www.stats.ox.ac.uk/~snijders/siena/HarryPotterData.html'
citation = [('G. Bossaert, N. Meidert, "\'We are only as strong as we are united, as weak as we are divided\'. A dynamic analysis of the peer support networks in the Harry Potter books." Open Journal of Applied Sciences 3(2), 174-185 (2013)', 'https://doi.org/10.4236/ojapps.2013.32024')]
[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/harry_potter_support/__init__.py b/entries/harry_potter_support/__init__.py
index 8a62136..00808aa 100644
--- a/entries/harry_potter_support/__init__.py
+++ b/entries/harry_potter_support/__init__.py
@@ -45,7 +45,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: harry_potter_support efc0784
diff --git a/entries/harry_potter_support/__init__.py b/entries/harry_potter_support/__init__.py
new file mode 100644
index 0000000..8a62136
--- /dev/null
+++ b/entries/harry_potter_support/__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 = "Harry Potter peer support networks (2013)"
+description = """Peer support among 64 students of Hogwarts in the first six Harry Potter books by J. K. Rowling, coded by G. Bossaert and N. Meidert from the e-books, and distributed by T. Snijders with the SIENA software. Each book narrates one school year. A tie was coded when a student voluntarily gave another student one of four types of support: emotional support, instrumental help, information, or praise. Only interactions between two living students attending Hogwarts at the same time were coded. Of the 80 students mentioned in the series, 16 were excluded because the time they entered or left Hogwarts is not known. According to the authors, the networks are quite heterogeneous over time.
+
+A directed edge (i, j) in network `bookN` indicates that student i supported student j in book N. The diagonal entries of the source matrices (some of which are nonzero) are ignored.
+
+The networks have the following properties:
+
+- Nodes: `name`, the name of the character; `schoolyear`, the year the student entered Hogwarts; `gender` (1: male, 2: female); `house` (1: Gryffindor, 2: Hufflepuff, 3: Ravenclaw, 4: Slytherin); `present`, whether the student attended Hogwarts during the book, according to the composition change file of the data set."""
+tags = ['Social', 'Fictional', 'Unweighted', 'Metadata', 'Temporal']
+url = 'https://www.stats.ox.ac.uk/~snijders/siena/HarryPotterData.html'
+citation = [('G. Bossaert, N. Meidert, "\'We are only as strong as we are united, as weak as we are divided\'. A dynamic analysis of the peer support networks in the Harry Potter books." Open Journal of Applied Sciences 3(2), 174-185 (2013)', 'https://doi.org/10.4236/ojapps.2013.32024')]
+icon_hash = '5944abe54ed8f1bb6022a49d'
+upstream_license = None
+upstream_prefix = 'https://www.stats.ox.ac.uk/~snijders/siena'
+z = 'bossaert_meidert_harrypotter.zip:'
+files = [((f'{z}hpbook{b}.txt', f'{z}hpnames.txt', f'{z}hpattributes.txt',
+ f'{z}compositionchange.dat'), f'book{b}', None) for b in range(1, 7)]
+
+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
+ b = int(alt[4:])
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "r"))
+ for fn in fnames]
+ A = numpy.loadtxt(fs[0], dtype="int")
+ names = [line.split("\t", 1)[1].strip().strip('"')
+ for line in list(fs[1])[1:] if line.strip()]
+ att = numpy.loadtxt(fs[2], dtype="int", skiprows=1)
+ cc = numpy.loadtxt(fs[3], dtype="int")
+ numpy.fill_diagonal(A, 0)
+ g = Graph(directed=True)
+ g.add_vertex(A.shape[0])
+ g.add_edge_list(numpy.transpose(A.nonzero()))
+ g.vp.name = g.new_vp("string", vals=names)
+ for i, p in enumerate(["schoolyear", "gender", "house"]):
+ g.vp[p] = g.new_vp("int", vals=att[:, i + 1])
+ g.vp.present = g.new_vp("bool", vals=(cc[:, 0] <= b) & (b <= cc[:, 1]))
+ yield alt, g