logo Netzschleuder network catalog, repository, and centrifuge

History of jodie_wikipedia

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/jodie_wikipedia/__init__.py b/entries/jodie_wikipedia/__init__.py
index ef5161f..9d5abfa 100644
--- a/entries/jodie_wikipedia/__init__.py
+++ b/entries/jodie_wikipedia/__init__.py
@@ -38,7 +38,7 @@ The networks have the following properties:
 tags = ['Informational', 'Web graph', 'Social', 'Online', 'Multigraph', 'Timestamps', 'Metadata']
 url = ['http://snap.stanford.edu/jodie/', 'https://github.com/claws-lab/jodie']
 citation = [('S. Kumar, X. Zhang, J. Leskovec, "Predicting Dynamic Embedding Trajectory in Temporal Interaction Networks." Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 1269-1278 (2019)', 'https://doi.org/10.1145/3292500.3330895')]
-icon_hash = None
+date_added = '2026-10-25'
 upstream_license = None
 upstream_prefix = 'http://snap.stanford.edu/jodie'
 files = [('wikipedia.csv', 'wikipedia', 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/jodie_wikipedia/__init__.py b/entries/jodie_wikipedia/__init__.py
index b40ccf5..ef5161f 100644
--- a/entries/jodie_wikipedia/__init__.py
+++ b/entries/jodie_wikipedia/__init__.py
@@ -28,8 +28,13 @@ description = """Temporal bipartite networks of interactions between users and i
 
 The networks have the following properties:
 
-- `wikipedia`: nodes: `id`, the identifier of the editor or page in the original data; `is_page`, whether the node is a page (otherwise it is an editor). Edges: `time`, the time of the edit, in seconds since the first edit in the data; `banned`, 1 if this is the last edit of an editor who was then banned, otherwise 0; `features`, the 172-dimensional LIWC feature vector of the edit text.
-- `reddit`, `mooc`, `lastfm`: nodes: `id`, the identifier of the user or item in the data; `is_item`, whether the node is an item (a subreddit, course item or song; otherwise a user). Edges: `time`, the time of the interaction, in seconds since the first interaction in the data; `reddit` and `mooc`: `label`, 1 if the user was banned after this post (`reddit`) or dropped out after this action (`mooc`), otherwise 0; `features`, the feature vector of the interaction (172 LIWC categories for `reddit`, 4 values for `mooc`)."""
+- (Node) `id`: the identifier of the editor or page in the original data (`wikipedia`), or of the user or item in the data (`reddit`, `mooc`, `lastfm`).
+- (Node) `is_page` (`wikipedia`): whether the node is a page (otherwise it is an editor).
+- (Node) `is_item` (`reddit`, `mooc`, `lastfm`): whether the node is an item (a subreddit, course item or song; otherwise a user).
+- (Edge) `time`: the time of the edit (`wikipedia`) or of the interaction (`reddit`, `mooc`, `lastfm`), in seconds since the first edit or interaction in the data.
+- (Edge) `banned` (`wikipedia`): 1 if this is the last edit of an editor who was then banned, otherwise 0.
+- (Edge) `label` (`reddit` and `mooc`): 1 if the user was banned after this post (`reddit`) or dropped out after this action (`mooc`), otherwise 0.
+- (Edge) `features` (`wikipedia`, `reddit` and `mooc`): the feature vector of the edit text or of the interaction (172 LIWC categories for `wikipedia` and `reddit`, 4 values for `mooc`)."""
 tags = ['Informational', 'Web graph', 'Social', 'Online', 'Multigraph', 'Timestamps', 'Metadata']
 url = ['http://snap.stanford.edu/jodie/', 'https://github.com/claws-lab/jodie']
 citation = [('S. Kumar, X. Zhang, J. Leskovec, "Predicting Dynamic Embedding Trajectory in Temporal Interaction Networks." Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 1269-1278 (2019)', 'https://doi.org/10.1145/3292500.3330895')]
[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/jodie_wikipedia/__init__.py b/entries/jodie_wikipedia/__init__.py
index 8421ce6..b40ccf5 100644
--- a/entries/jodie_wikipedia/__init__.py
+++ b/entries/jodie_wikipedia/__init__.py
@@ -143,7 +143,6 @@ def parse_interactions(name, fname, alt):
 @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] jodie_wikipedia: add the Reddit, MOOC and Last.fm networks of JODIE by Tiago de Paula Peixoto 396bd64
The entry had only the Wikipedia network of the JODIE study of Kumar,
Zhang and Leskovec; its three other temporal interaction networks
(Reddit posts, MOOC actions, Last.fm listens) are added. The existing
network, so far unnamed, is now named `wikipedia`, since an unnamed
network cannot coexist with named ones; its structure and properties
are unchanged.

Changed: upstream jodie_wikipedia
diff --git a/entries/jodie_wikipedia/__init__.py b/entries/jodie_wikipedia/__init__.py
index 7359595..8421ce6 100644
--- a/entries/jodie_wikipedia/__init__.py
+++ b/entries/jodie_wikipedia/__init__.py
@@ -18,25 +18,127 @@
 
 from .. import *
 
-title = "Wikipedia page edits (JODIE, 2019)"
-description = """A bipartite network of Wikipedia editors and the pages they edited, compiled by Kumar, Zhang and Leskovec from one month of public Wikipedia edit records. Only the 1,000 most edited pages and the editors who made at least 5 edits to them are included. Each edit is a timestamped edge between an editor and a page; repeated edits of the same page by the same editor are separate edges. Edges are annotated with a feature vector computed from the text of the edit, using the categories of the Linguistic Inquiry and Word Count (LIWC) lexicon, and with a label marking the last edit of editors that were subsequently banned from Wikipedia (217 editors).
+title = "Wikipedia edits, Reddit posts, MOOC actions and Last.fm listens (JODIE, 2019)"
+description = """Temporal bipartite networks of interactions between users and items, compiled by S. Kumar, X. Zhang and J. Leskovec as benchmarks for the JODIE method of dynamic embeddings. Each interaction is a timestamped edge between a user and an item; repeated interactions of the same user with the same item are separate edges. The times are given in seconds since the first interaction of each data set, without the absolute dates. User and item identifiers were anonymized (users and items are numbered separately). There are four networks:
 
-The network has the following properties:
+- `wikipedia`: one month of public Wikipedia edit records, between the 1,000 most edited pages and the editors who made at least 5 edits to them. Each edit has a feature vector computed from its text, with the categories of the Linguistic Inquiry and Word Count (LIWC) lexicon, and a label marking the last edit of the editors that were subsequently banned from Wikipedia (217 editors).
+- `reddit`: one month of posts on Reddit, from the Pushshift data dump, between the 10,000 most active users and the 1,000 most active subreddits (the items; 984 of them appear in the data), 672,447 posts. Each post has a LIWC feature vector computed from its text, and a label marking the last post of the users that were subsequently banned from Reddit (366 users).
+- `mooc`: the actions (e.g. viewing a video or submitting an answer) of 7,047 students on 97 items (videos, answers, etc.; 98 according to the authors) of a massive open online course (MOOC), from the data of the KDD Cup 2015, 411,749 actions. Each action has a 4-dimensional feature vector (whose meaning is not documented), and a label marking the actions after which the student dropped out of the course (4,066 drop-out events).
+- `lastfm`: one month of songs listened to by 980 users of Last.fm (1,000 according to the authors), restricted to the 1,000 most listened songs, 1,293,103 listens, from the data of B. Hidasi and D. Tikk. There are no features or labels (the placeholder features of the data, all zero, are left out).
 
-- Nodes: `id`, the identifier of the editor or page in the original data (editors and pages are numbered separately); `is_page`, whether the node is a page (otherwise it is an editor).
-- Edges: `time`, the time of the edit, in seconds since the first edit in the data; `banned`, 1 if this is the last edit of an editor who was then banned, otherwise 0; `features`, the 172-dimensional LIWC feature vector of the edit text."""
-tags = ['Informational', 'Web graph', 'Multigraph', 'Timestamps', 'Metadata']
-url = 'http://snap.stanford.edu/jodie/'
-citation = [('S. Kumar, X. Zhang, J. Leskovec, "Predicting Dynamic Embedding Trajectory in Temporal Interaction Networks." Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (2019)', 'https://doi.org/10.1145/3292500.3330895')]
+The networks have the following properties:
+
+- `wikipedia`: nodes: `id`, the identifier of the editor or page in the original data; `is_page`, whether the node is a page (otherwise it is an editor). Edges: `time`, the time of the edit, in seconds since the first edit in the data; `banned`, 1 if this is the last edit of an editor who was then banned, otherwise 0; `features`, the 172-dimensional LIWC feature vector of the edit text.
+- `reddit`, `mooc`, `lastfm`: nodes: `id`, the identifier of the user or item in the data; `is_item`, whether the node is an item (a subreddit, course item or song; otherwise a user). Edges: `time`, the time of the interaction, in seconds since the first interaction in the data; `reddit` and `mooc`: `label`, 1 if the user was banned after this post (`reddit`) or dropped out after this action (`mooc`), otherwise 0; `features`, the feature vector of the interaction (172 LIWC categories for `reddit`, 4 values for `mooc`)."""
+tags = ['Informational', 'Web graph', 'Social', 'Online', 'Multigraph', 'Timestamps', 'Metadata']
+url = ['http://snap.stanford.edu/jodie/', 'https://github.com/claws-lab/jodie']
+citation = [('S. Kumar, X. Zhang, J. Leskovec, "Predicting Dynamic Embedding Trajectory in Temporal Interaction Networks." Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 1269-1278 (2019)', 'https://doi.org/10.1145/3292500.3330895')]
 icon_hash = None
 upstream_license = None
 upstream_prefix = 'http://snap.stanford.edu/jodie'
-files = [('wikipedia.csv', None, None)]
+files = [('wikipedia.csv', 'wikipedia', None),
+         ('reddit.csv', 'reddit', None),
+         ('mooc.csv', 'mooc', None),
+         ('lastfm.csv', 'lastfm', None)]
 
 def fetch_upstream(force=False):
     return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
                                 force)
 
+def parse_wikipedia(name, fnames, alt):
+    if isinstance(fnames, str):
+        fnames = [fnames]
+    with ExitStack() as stack:
+        fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+
+        # Columns: user_id, item_id, timestamp, state_label, followed by
+        # the features of the edit
+        rows = csv.reader(fs[0])
+        next(rows)
+        users = {}
+        pages = {}
+        edges = []
+        times = []
+        banned = []
+        features = []
+        for row in rows:
+            u = users.setdefault(int(row[0]), len(users))
+            p = pages.setdefault(int(row[1]), len(pages))
+            edges.append((u, p))
+            times.append(int(float(row[2])))
+            banned.append(int(row[3]))
+            features.append([float(x) for x in row[4:]])
+
+        g = Graph(directed=False)
+        g.add_vertex(len(users) + len(pages))
+        g.vp.id = g.new_vp("int")
+        g.vp.is_page = g.new_vp("bool")
+        for uid, u in users.items():
+            g.vp.id[u] = uid
+        for pid, p in pages.items():
+            g.vp.id[len(users) + p] = pid
+            g.vp.is_page[len(users) + p] = True
+
+        g.ep.time = g.new_ep("int64_t")
+        g.ep.banned = g.new_ep("bool")
+        g.ep.features = g.new_ep("vector<double>")
+        g.add_edge_list([(u, len(users) + p) for u, p in edges])
+        # Edge indices follow the order in which the edges were added
+        g.ep.time.a = times
+        g.ep.banned.a = banned
+        for e in g.edges():
+            g.ep.features[e] = features[g.edge_index[e]]
+    return g
+
+def parse_interactions(name, fname, alt):
+    # Columns: user_id, item_id, timestamp, state_label, followed by
+    # the features of the interaction
+    E = []
+    times = []
+    labels = []
+    feats = []
+    with open_upstream_file(name, fname, "r") as f:
+        header = next(f)
+        assert header.startswith("user_id,item_id,timestamp,state_label")
+        for line in f:
+            row = line.rstrip("\n").split(",")
+            E.append((int(row[0]), int(row[1])))
+            times.append(float(row[2]))
+            labels.append(int(row[3]))
+            if alt != "lastfm":
+                feats.append(numpy.array(row[4:], dtype="float32"))
+            else:
+                assert all(float(x) == 0 for x in row[4:])
+    E = numpy.array(E, dtype="int64")
+    users = numpy.unique(E[:, 0])
+    items = numpy.unique(E[:, 1])
+    assert (users == numpy.arange(len(users))).all()
+    assert (items == numpy.arange(len(items))).all()
+    g = Graph(directed=False)
+    g.add_vertex(len(users) + len(items))
+    g.vp.id = g.new_vp("int64_t")
+    g.vp.id.a[:len(users)] = users
+    g.vp.id.a[len(users):] = items
+    g.vp.is_item = g.new_vp("bool")
+    g.vp.is_item.a[len(users):] = True
+    E[:, 1] += len(users)
+    g.add_edge_list(E)
+    del E
+    # edge indices follow the order in which the edges were added
+    g.ep.time = g.new_ep("double")
+    g.ep.time.a = times
+    del times
+    if alt != "lastfm":
+        g.ep.label = g.new_ep("bool")
+        g.ep.label.a = labels
+        feats = numpy.array(feats, dtype="float32")
+        g.ep.features = g.new_ep("vector<double>")
+        g.ep.features.set_2d_array(feats.T)
+    else:
+        assert not any(labels)
+    del feats, labels
+    return g
+
 @cache_network()
 @coerce_props()
 @annotate()
@@ -46,46 +148,7 @@ def parse(alts=None):
     for fnames, alt, fmt in files:
         if alts is not None and alt not in alts:
             continue
-        if isinstance(fnames, str):
-            fnames = [fnames]
-        with ExitStack() as stack:
-            fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
-
-            # Columns: user_id, item_id, timestamp, state_label, followed by
-            # the features of the edit
-            rows = csv.reader(fs[0])
-            next(rows)
-            users = {}
-            pages = {}
-            edges = []
-            times = []
-            banned = []
-            features = []
-            for row in rows:
-                u = users.setdefault(int(row[0]), len(users))
-                p = pages.setdefault(int(row[1]), len(pages))
-                edges.append((u, p))
-                times.append(int(float(row[2])))
-                banned.append(int(row[3]))
-                features.append([float(x) for x in row[4:]])
-
-            g = Graph(directed=False)
-            g.add_vertex(len(users) + len(pages))
-            g.vp.id = g.new_vp("int")
-            g.vp.is_page = g.new_vp("bool")
-            for uid, u in users.items():
-                g.vp.id[u] = uid
-            for pid, p in pages.items():
-                g.vp.id[len(users) + p] = pid
-                g.vp.is_page[len(users) + p] = True
-
-            g.ep.time = g.new_ep("int64_t")
-            g.ep.banned = g.new_ep("bool")
-            g.ep.features = g.new_ep("vector<double>")
-            g.add_edge_list([(u, len(users) + p) for u, p in edges])
-            # Edge indices follow the order in which the edges were added
-            g.ep.time.a = times
-            g.ep.banned.a = banned
-            for e in g.edges():
-                g.ep.features[e] = features[g.edge_index[e]]
-        yield alt, g
+        if alt == "wikipedia":
+            yield alt, parse_wikipedia(name, fnames, alt)
+        else:
+            yield alt, parse_interactions(name, fnames, alt)
[entries] New entry: jodie_wikipedia by Tiago de Paula Peixoto 9c1e3aa
diff --git a/entries/jodie_wikipedia/__init__.py b/entries/jodie_wikipedia/__init__.py
new file mode 100644
index 0000000..7359595
--- /dev/null
+++ b/entries/jodie_wikipedia/__init__.py
@@ -0,0 +1,91 @@
+#! /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 = "Wikipedia page edits (JODIE, 2019)"
+description = """A bipartite network of Wikipedia editors and the pages they edited, compiled by Kumar, Zhang and Leskovec from one month of public Wikipedia edit records. Only the 1,000 most edited pages and the editors who made at least 5 edits to them are included. Each edit is a timestamped edge between an editor and a page; repeated edits of the same page by the same editor are separate edges. Edges are annotated with a feature vector computed from the text of the edit, using the categories of the Linguistic Inquiry and Word Count (LIWC) lexicon, and with a label marking the last edit of editors that were subsequently banned from Wikipedia (217 editors).
+
+The network has the following properties:
+
+- Nodes: `id`, the identifier of the editor or page in the original data (editors and pages are numbered separately); `is_page`, whether the node is a page (otherwise it is an editor).
+- Edges: `time`, the time of the edit, in seconds since the first edit in the data; `banned`, 1 if this is the last edit of an editor who was then banned, otherwise 0; `features`, the 172-dimensional LIWC feature vector of the edit text."""
+tags = ['Informational', 'Web graph', 'Multigraph', 'Timestamps', 'Metadata']
+url = 'http://snap.stanford.edu/jodie/'
+citation = [('S. Kumar, X. Zhang, J. Leskovec, "Predicting Dynamic Embedding Trajectory in Temporal Interaction Networks." Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (2019)', 'https://doi.org/10.1145/3292500.3330895')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'http://snap.stanford.edu/jodie'
+files = [('wikipedia.csv', 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
+        if isinstance(fnames, str):
+            fnames = [fnames]
+        with ExitStack() as stack:
+            fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+
+            # Columns: user_id, item_id, timestamp, state_label, followed by
+            # the features of the edit
+            rows = csv.reader(fs[0])
+            next(rows)
+            users = {}
+            pages = {}
+            edges = []
+            times = []
+            banned = []
+            features = []
+            for row in rows:
+                u = users.setdefault(int(row[0]), len(users))
+                p = pages.setdefault(int(row[1]), len(pages))
+                edges.append((u, p))
+                times.append(int(float(row[2])))
+                banned.append(int(row[3]))
+                features.append([float(x) for x in row[4:]])
+
+            g = Graph(directed=False)
+            g.add_vertex(len(users) + len(pages))
+            g.vp.id = g.new_vp("int")
+            g.vp.is_page = g.new_vp("bool")
+            for uid, u in users.items():
+                g.vp.id[u] = uid
+            for pid, p in pages.items():
+                g.vp.id[len(users) + p] = pid
+                g.vp.is_page[len(users) + p] = True
+
+            g.ep.time = g.new_ep("int64_t")
+            g.ep.banned = g.new_ep("bool")
+            g.ep.features = g.new_ep("vector<double>")
+            g.add_edge_list([(u, len(users) + p) for u, p in edges])
+            # Edge indices follow the order in which the edges were added
+            g.ep.time.a = times
+            g.ep.banned.a = banned
+            for e in g.edges():
+                g.ep.features[e] = features[g.edge_index[e]]
+        yield alt, g