logo Netzschleuder network catalog, repository, and centrifuge

History of hamsterster

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/hamsterster/__init__.py b/entries/hamsterster/__init__.py
index 711e357..a063074 100644
--- a/entries/hamsterster/__init__.py
+++ b/entries/hamsterster/__init__.py
@@ -40,7 +40,7 @@ url = ['http://konect.cc/networks/petster-hamster',
        'http://konect.cc/networks/petster-hamster-household']
 citation = [('J. Kunegis, "Hamsterster full network dataset." KONECT, the Koblenz Network Collection (2017)', 'http://konect.cc/networks/petster-hamster'),
             ('J. Kunegis, "KONECT -- The Koblenz Network Collection." Proceedings of the 22nd International Conference on World Wide Web Companion, 1343-1350 (2013)', 'https://doi.org/10.1145/2487788.2488173')]
-icon_hash = None
+date_added = '2026-10-27'
 upstream_license = None
 upstream_prefix = 'http://konect.cc/files'
 files = [(('download.tsv.petster-hamster.tar.bz2:petster-hamster/out.petster-hamster',
[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/hamsterster/__init__.py b/entries/hamsterster/__init__.py
index d832d29..711e357 100644
--- a/entries/hamsterster/__init__.py
+++ b/entries/hamsterster/__init__.py
@@ -33,8 +33,8 @@ KONECT also distributes the friendships alone (`petster-friendships-hamster` and
 
 The networks have the following properties:
 
-- `full`: `name`, the name of the pet; `joined`, the date the profile was created; `species`, e.g. `Hamster (Syrian)`; `coloring`; `gender`; `birthday`; `age` (as given, e.g. `49 months` or `Gone to Hamster Heaven`); `hometown`; `favorite_toy` and `favorite_food` (all as given in the profile; empty for the 5 users without metadata). The data also have a field for the favorite activity, which is left out, since it is identical to the favorite toy for all users (an error of the data).
-- Edge `family` (`full` only): whether the edge is a family link (otherwise a friendship)."""
+- (Node) `full`: `name`, the name of the pet; `joined`, the date the profile was created; `species`, e.g. `Hamster (Syrian)`; `coloring`; `gender`; `birthday`; `age` (as given, e.g. `49 months` or `Gone to Hamster Heaven`); `hometown`; `favorite_toy` and `favorite_food` (all as given in the profile; empty for the 5 users without metadata). The data also have a field for the favorite activity, which is left out, since it is identical to the favorite toy for all users (an error of the data).
+- (Edge) `family` (`full` only): whether the edge is a family link (otherwise a friendship)."""
 tags = ['Social', 'Online', 'Unweighted', 'Metadata']
 url = ['http://konect.cc/networks/petster-hamster',
        'http://konect.cc/networks/petster-hamster-household']
[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/hamsterster/__init__.py b/entries/hamsterster/__init__.py
index 5016836..d832d29 100644
--- a/entries/hamsterster/__init__.py
+++ b/entries/hamsterster/__init__.py
@@ -67,7 +67,6 @@ def read_edges(name, fname):
 @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: hamsterster by Tiago de Paula Peixoto 887e6d6
diff --git a/entries/hamsterster/__init__.py b/entries/hamsterster/__init__.py
new file mode 100644
index 0000000..5016836
--- /dev/null
+++ b/entries/hamsterster/__init__.py
@@ -0,0 +1,109 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 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/>.
+
+
+
+import shlex
+
+from .. import *
+
+
+title = "Hamsterster pet social network (2017)"
+description = """Social networks of the users of hamsterster.com, a social website for hamster (and other small pet) owners, in which each user profile is a pet, as crawled and distributed by KONECT:
+
+- `full`: friendships and family links between the users. Each node is a user, and an undirected edge connects two users who are friends, or whose profiles belong to the same household (the edge property `family` tells which). The users have the metadata of their profiles.
+- `households`: the family links (links between profiles of the same household) only, from a separate KONECT dataset, whose user indices are not those of `full`, and without metadata. It has 4,032 links, while `full` has 4,097 family links.
+
+KONECT also distributes the friendships alone (`petster-friendships-hamster` and `petster-hamster-friend`, identical up to the numbering of the users); they are not included as separate networks, since they are the edges of `full` that are not family links.
+
+The networks have the following properties:
+
+- `full`: `name`, the name of the pet; `joined`, the date the profile was created; `species`, e.g. `Hamster (Syrian)`; `coloring`; `gender`; `birthday`; `age` (as given, e.g. `49 months` or `Gone to Hamster Heaven`); `hometown`; `favorite_toy` and `favorite_food` (all as given in the profile; empty for the 5 users without metadata). The data also have a field for the favorite activity, which is left out, since it is identical to the favorite toy for all users (an error of the data).
+- Edge `family` (`full` only): whether the edge is a family link (otherwise a friendship)."""
+tags = ['Social', 'Online', 'Unweighted', 'Metadata']
+url = ['http://konect.cc/networks/petster-hamster',
+       'http://konect.cc/networks/petster-hamster-household']
+citation = [('J. Kunegis, "Hamsterster full network dataset." KONECT, the Koblenz Network Collection (2017)', 'http://konect.cc/networks/petster-hamster'),
+            ('J. Kunegis, "KONECT -- The Koblenz Network Collection." Proceedings of the 22nd International Conference on World Wide Web Companion, 1343-1350 (2013)', 'https://doi.org/10.1145/2487788.2488173')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'http://konect.cc/files'
+files = [(('download.tsv.petster-hamster.tar.bz2:petster-hamster/out.petster-hamster',
+           'download.tsv.petster-hamster.tar.bz2:petster-hamster/ent.petster-hamster',
+           'download.tsv.petster-friendships-hamster.tar.bz2:petster-friendships-hamster/out.petster-friendships-hamster-uniq'),
+          'full', None),
+         (('download.tsv.petster-hamster-household.tar.bz2:petster-hamster-household/out.petster-hamster-household',),
+          'households', None)]
+
+fields = ["name", "joined", "species", "coloring", "gender", "birthday", "age",
+          "hometown", "favorite_toy", "favorite_activity", "favorite_food"]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+def read_edges(name, fname):
+    "The edges (1-based node ids) of a KONECT out file."
+    with open_upstream_file(name, fname, "r") as f:
+        return [tuple(int(x) for x in l.split()[:2]) for l in f
+                if l.strip() and not l.startswith("%")]
+
+@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
+        edges = read_edges(name, fnames[0])
+        g = Graph(directed=False)
+        if alt == "full":
+            N = max(max(e) for e in edges)
+            g.add_vertex(N)
+            g.add_edge_list([(s - 1, t - 1) for s, t in edges])
+        else:
+            # the node ids of the households are not contiguous
+            g.vp.konect_id = g.add_edge_list(numpy.array(edges), hashed=True)
+            del g.vp["konect_id"]
+        if alt == "full":
+            # "<id>" "<name>" "<joined>" ... (quoted fields)
+            meta = {}
+            with open_upstream_file(name, fnames[1], "rb") as f:
+                for l in f:
+                    # mostly UTF-8, with some lines in Latin-1 (Windows-1252)
+                    try:
+                        l = l.decode("utf-8")
+                    except UnicodeDecodeError:
+                        l = l.decode("cp1252", "replace")
+                    if l.startswith("%") or not l.strip():
+                        continue
+                    row = [html.unescape(x).replace("\xa0", " ").replace("  ", " ")
+                           for x in shlex.split(l)]
+                    assert len(row) == len(fields) + 1
+                    meta[int(row[0])] = row[1:]
+            for i, k in enumerate(fields):
+                if k == "favorite_activity":
+                    continue
+                g.vp[k] = g.new_vp("string", vals=[meta[v + 1][i] if v + 1 in meta else ""
+                                                   for v in range(N)])
+            friends = set(frozenset(e) for e in read_edges(name, fnames[2]))
+            g.ep.family = g.new_ep("bool", vals=[frozenset(e) not in friends
+                                                 for e in edges])
+        yield alt, g