History of penguins_kyoto
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/penguins_kyoto/__init__.py b/entries/penguins_kyoto/__init__.py
index 0eea9a2..341eab8 100644
--- a/entries/penguins_kyoto/__init__.py
+++ b/entries/penguins_kyoto/__init__.py
@@ -31,7 +31,7 @@ The network has the following properties:
tags = ['Social', 'Animal', 'Multilayer', 'Unweighted', 'Metadata']
url = 'https://bitbucket.org/mhfeng/penguins_of_kyoto/src'
citation = [('H. Z. Brooks, M. Feng, "Penguins of Kyoto Multilayer Network." Bitbucket repository (2020)', 'https://bitbucket.org/mhfeng/penguins_of_kyoto/src')]
-icon_hash = '5f0fd41928ef477802467688'
+date_added = '2026-10-25'
upstream_license = None
# Archive of the repository at a fixed commit
upstream_prefix = 'https://bitbucket.org/mhfeng/penguins_of_kyoto/get'
[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/penguins_kyoto/__init__.py b/entries/penguins_kyoto/__init__.py
index 5f5f019..0eea9a2 100644
--- a/entries/penguins_kyoto/__init__.py
+++ b/entries/penguins_kyoto/__init__.py
@@ -23,8 +23,11 @@ description = """Multilayer network of the relationships among the 59 named peng
The network has the following properties:
-- Nodes: `name`, the name of the penguin (romanized); `sex`, "F" or "M"; `info`, a short description of the penguin from the chart (translated by M. Feng, "to be taken with a large grain of salt").
-- Edges: `layer`, the type of relationship; `info`, a description of the relationship, if given in the chart (translated). One description of the source data (for the pair Oike → Shichijou in the "Exes" layer) refers to a relationship that is absent from the adjacency matrix, and is not included."""
+- (Node) `name`: the name of the penguin (romanized).
+- (Node) `sex`: "F" or "M".
+- (Node) `info`: a short description of the penguin from the chart (translated by M. Feng, "to be taken with a large grain of salt").
+- (Edge) `layer`: the type of relationship.
+- (Edge) `info`: a description of the relationship, if given in the chart (translated). One description of the source data (for the pair Oike → Shichijou in the "Exes" layer) refers to a relationship that is absent from the adjacency matrix, and is not included."""
tags = ['Social', 'Animal', 'Multilayer', 'Unweighted', 'Metadata']
url = 'https://bitbucket.org/mhfeng/penguins_of_kyoto/src'
citation = [('H. Z. Brooks, M. Feng, "Penguins of Kyoto Multilayer Network." Bitbucket repository (2020)', 'https://bitbucket.org/mhfeng/penguins_of_kyoto/src')]
[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/penguins_kyoto/__init__.py b/entries/penguins_kyoto/__init__.py
index 0f9f0c1..5f5f019 100644
--- a/entries/penguins_kyoto/__init__.py
+++ b/entries/penguins_kyoto/__init__.py
@@ -49,7 +49,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: penguins_kyoto 6fe7d0f
diff --git a/entries/penguins_kyoto/__init__.py b/entries/penguins_kyoto/__init__.py
new file mode 100644
index 0000000..0f9f0c1
--- /dev/null
+++ b/entries/penguins_kyoto/__init__.py
@@ -0,0 +1,96 @@
+#! /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 = "Penguins of Kyoto Aquarium relationships (2020)"
+description = """Multilayer network of the relationships among the 59 named penguins at the Kyoto Aquarium, Japan, encoded by Heather Z. Brooks and Michelle Feng from the 2020 version of the penguin relationship chart ("sokanzu") published by the aquarium staff. Nodes are penguins (staff members and unnamed former partners are not included), and directed edges are relationships of six types, given by the edge property `layer`: "Couples", "Exes", "Complicated" ("it's complicated"), "Friends", "Enemies", and "Family". Couples and friends are always reciprocated, while the other relationships can be one-sided (e.g. a penguin rejected by another). In the family layer, edges point from parents to their offspring. The edge directions follow the "source" and "sink" convention of the edge metadata files of the source data (in the source adjacency matrices, rows correspond to the sink and columns to the source of each relationship, which is the transpose of the convention of the authors' GEXF files).
+
+The network has the following properties:
+
+- Nodes: `name`, the name of the penguin (romanized); `sex`, "F" or "M"; `info`, a short description of the penguin from the chart (translated by M. Feng, "to be taken with a large grain of salt").
+- Edges: `layer`, the type of relationship; `info`, a description of the relationship, if given in the chart (translated). One description of the source data (for the pair Oike → Shichijou in the "Exes" layer) refers to a relationship that is absent from the adjacency matrix, and is not included."""
+tags = ['Social', 'Animal', 'Multilayer', 'Unweighted', 'Metadata']
+url = 'https://bitbucket.org/mhfeng/penguins_of_kyoto/src'
+citation = [('H. Z. Brooks, M. Feng, "Penguins of Kyoto Multilayer Network." Bitbucket repository (2020)', 'https://bitbucket.org/mhfeng/penguins_of_kyoto/src')]
+icon_hash = '5f0fd41928ef477802467688'
+upstream_license = None
+# Archive of the repository at a fixed commit
+upstream_prefix = 'https://bitbucket.org/mhfeng/penguins_of_kyoto/get'
+
+_archive = 'ba1e9dce73ab64957123f34951fa7c09c5bfd1c2.zip:mhfeng-penguins_of_kyoto-ba1e9dce73ab/csv/Penguins of Kyoto - '
+_layers = ['Couples', 'Exes', 'Complicated', 'Friends', 'Enemies', 'Family']
+
+files = [(tuple([f'{_archive}Metadata.csv'] +
+ [f'{_archive}{l}.csv' for l in _layers] +
+ [f'{_archive}{l} Metadata.csv' for l in _layers if l != "Family"]),
+ 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 = [list(csv.reader(io.TextIOWrapper(stack.enter_context(open_upstream_file(name, fn, "rb")),
+ encoding="utf-8-sig")))
+ for fn in fnames]
+ meta = fs[0][1:]
+ mats = dict(zip(_layers, fs[1:7]))
+ edge_meta = dict(zip([l for l in _layers if l != "Family"], fs[7:]))
+
+ g = Graph(directed=True)
+ g.add_vertex(len(meta))
+ g.vp.name = g.new_vp("string", vals=[r[0].strip() for r in meta])
+ g.vp.sex = g.new_vp("string", vals=[r[1].strip() for r in meta])
+ g.vp.info = g.new_vp("string", vals=[r[2].strip() for r in meta])
+
+ # The matrix headers use some alternative spellings of the names
+ # (e.g. "Yosha" for "Yoshiya"), which also occur in the edge metadata
+ idx = {r[0].strip(): i for i, r in enumerate(meta)}
+ for i, n in enumerate(mats["Couples"][0][1:]):
+ idx.setdefault(n.strip(), i)
+
+ g.ep.layer = g.new_ep("string")
+ g.ep.info = g.new_ep("string")
+ for l in _layers:
+ rows = mats[l]
+ assert len(rows) - 1 == g.num_vertices()
+ info = {}
+ for r in edge_meta.get(l, [])[1:]:
+ s, t = idx[r[0].strip()], idx[r[1].strip()]
+ info[(s, t)] = r[2].strip()
+ if l == "Couples": # listed once per couple
+ info[(t, s)] = r[2].strip()
+ for i, row in enumerate(rows[1:]):
+ for j, x in enumerate(row[1:]):
+ if int(x) == 0:
+ continue
+ # row: sink, column: source
+ e = g.add_edge(j, i)
+ g.ep.layer[e] = l
+ g.ep.info[e] = info.get((j, i), "")
+ yield alt, g