logo Netzschleuder network catalog, repository, and centrifuge

History of stackexchange_tags

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/stackexchange_tags/__init__.py b/entries/stackexchange_tags/__init__.py
index 3e38472..e29ed02 100644
--- a/entries/stackexchange_tags/__init__.py
+++ b/entries/stackexchange_tags/__init__.py
@@ -36,7 +36,7 @@ url = ['https://www.cs.cornell.edu/~arb/data/tags-ask-ubuntu/',
        'https://www.cs.cornell.edu/~arb/data/tags-math-sx/',
        'https://www.cs.cornell.edu/~arb/data/tags-stack-overflow/']
 citation = [('A. R. Benson, R. Abebe, M. T. Schaub, A. Jadbabaie, J. Kleinberg, "Simplicial closure and higher-order link prediction." Proceedings of the National Academy of Sciences 115(48), E11221-E11230 (2018)', 'https://doi.org/10.1073/pnas.1800683115')]
-icon_hash = None
+date_added = '2026-10-25'
 upstream_license = ("Creative Commons Attribution-ShareAlike (CC BY-SA; version 3.0 or 4.0, depending on the date of each post)",
                     "https://stackoverflow.com/help/licensing")
 upstream_prefix = 'gdrive://'
[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/stackexchange_tags/__init__.py b/entries/stackexchange_tags/__init__.py
index 269d438..3e38472 100644
--- a/entries/stackexchange_tags/__init__.py
+++ b/entries/stackexchange_tags/__init__.py
@@ -27,9 +27,10 @@ description = """Bipartite networks of questions and the tags attached to them o
 
 The networks have the following properties:
 
-- `is_question`, whether the node is a question (otherwise a tag).
-- Tag nodes: `name`, the name of the tag.
-- Question nodes: `post_id`, the post id of the question on its site (so that, e.g., question 1 of `ask_ubuntu` is https://askubuntu.com/questions/1); `time`, the creation time of the question, in Unix time (seconds since 1970-01-01 UTC). The source data give the times in milliseconds relative to the earliest question; they were converted to absolute times by matching the creation times of a sample of the questions, obtained from the Stack Exchange API (the conversion is accurate to within one second)."""
+- (Node) `is_question`: whether the node is a question (otherwise a tag).
+- (Node) `name` (tags): the name of the tag.
+- (Node) `post_id` (questions): the post id of the question on its site (so that, e.g., question 1 of `ask_ubuntu` is https://askubuntu.com/questions/1).
+- (Node) `time` (questions): the creation time of the question, in Unix time (seconds since 1970-01-01 UTC). The source data give the times in milliseconds relative to the earliest question; they were converted to absolute times by matching the creation times of a sample of the questions, obtained from the Stack Exchange API (the conversion is accurate to within one second)."""
 tags = ['Informational', 'Online', 'Folksonomy', 'Unweighted', 'Timestamps', 'Metadata']
 url = ['https://www.cs.cornell.edu/~arb/data/tags-ask-ubuntu/',
        'https://www.cs.cornell.edu/~arb/data/tags-math-sx/',
[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/stackexchange_tags/__init__.py b/entries/stackexchange_tags/__init__.py
index dc7d313..269d438 100644
--- a/entries/stackexchange_tags/__init__.py
+++ b/entries/stackexchange_tags/__init__.py
@@ -66,7 +66,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: stackexchange_tags by Tiago de Paula Peixoto 170c635
diff --git a/entries/stackexchange_tags/__init__.py b/entries/stackexchange_tags/__init__.py
new file mode 100644
index 0000000..dc7d313
--- /dev/null
+++ b/entries/stackexchange_tags/__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 = "Stack Exchange question tags (2008-2017)"
+description = """Bipartite networks of questions and the tags attached to them on three question-and-answer sites of the Stack Exchange network, assembled by A. R. Benson and collaborators from the Stack Exchange data dump (archive.org), covering the complete history of each site up to August 2017. Each question carries between one and five tags indicating its topics, and is connected to its tags, and is timestamped with its creation time.
+
+- `ask_ubuntu`: Ask Ubuntu (askubuntu.com), a site for questions about the Ubuntu operating system. Questions span January 2009 to August 2017 (only five questions, migrated from other sites, predate the launch of the site in July 2010).
+- `math_sx`: Mathematics Stack Exchange (math.stackexchange.com). Questions span March 2010 to August 2017 (only one question, migrated from another site, predates the launch of the site in July 2010).
+- `stack_overflow`: Stack Overflow (stackoverflow.com), a site for programming questions. Questions span July 2008 to August 2017.
+
+The networks have the following properties:
+
+- `is_question`, whether the node is a question (otherwise a tag).
+- Tag nodes: `name`, the name of the tag.
+- Question nodes: `post_id`, the post id of the question on its site (so that, e.g., question 1 of `ask_ubuntu` is https://askubuntu.com/questions/1); `time`, the creation time of the question, in Unix time (seconds since 1970-01-01 UTC). The source data give the times in milliseconds relative to the earliest question; they were converted to absolute times by matching the creation times of a sample of the questions, obtained from the Stack Exchange API (the conversion is accurate to within one second)."""
+tags = ['Informational', 'Online', 'Folksonomy', 'Unweighted', 'Timestamps', 'Metadata']
+url = ['https://www.cs.cornell.edu/~arb/data/tags-ask-ubuntu/',
+       'https://www.cs.cornell.edu/~arb/data/tags-math-sx/',
+       'https://www.cs.cornell.edu/~arb/data/tags-stack-overflow/']
+citation = [('A. R. Benson, R. Abebe, M. T. Schaub, A. Jadbabaie, J. Kleinberg, "Simplicial closure and higher-order link prediction." Proceedings of the National Academy of Sciences 115(48), E11221-E11230 (2018)', 'https://doi.org/10.1073/pnas.1800683115')]
+icon_hash = None
+upstream_license = ("Creative Commons Attribution-ShareAlike (CC BY-SA; version 3.0 or 4.0, depending on the date of each post)",
+                    "https://stackoverflow.com/help/licensing")
+upstream_prefix = 'gdrive://'
+
+_ids = {"ask_ubuntu": ("1tb1ZJlXEJnlRkXpTuBZlOqqsFknWCkUV", "tags-ask-ubuntu"),
+        "math_sx": ("1eDevpF6EZs19rLouNpiKGLIlFOLUfKKG", "tags-math-sx"),
+        "stack_overflow": ("17XFOUNXR8Ecxhmt6YWMPt1uVr5yxiSz7", "tags-stack-overflow")}
+
+files = [(tuple(f"{did}:tar.gz:{d}/{d}-{x}.txt"
+                for x in ["nverts", "simplices", "times", "node-labels",
+                          "simplex-labels"]), alt, None)
+         for alt, (did, d) in _ids.items()]
+
+# Unix time (in ms) of the earliest question of each dataset, i.e. of time 0
+# in the source data, obtained by comparing the source times of a random
+# sample of 100 questions with their creation dates from the Stack Exchange
+# API (api.stackexchange.com/2.3/posts); the offsets are consistent with all
+# sampled questions to within 25 ms.
+_t0 = {"ask_ubuntu": 1231400875380,       # post 73180, 2009-01-08
+       "math_sx": 1269700400710,          # post 106814, 2010-03-27
+       "stack_overflow": 1217540572644}   # post 4, 2008-07-31
+
+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]
+            questions, tags = read_simplices(fs[0], fs[1])
+            times = read_ints(fs[2])
+            # Tag labels: "<id> <name>"
+            labels = {}
+            for line in fs[3]:
+                tid, tname = line.rstrip("\r\n").split(" ", 1)
+                labels[int(tid) - 1] = tname
+            post_ids = read_ints(fs[4])
+            N = max(max(labels) + 1, int(tags.max()) + 1)
+            g = bipartite_graph(questions, tags, len(times), N, "is_question")
+            del questions, tags
+            g.vp.name = g.new_vp("string")
+            for v, tname in labels.items():
+                g.vp.name[g.vertex(v)] = tname
+            g.vp.post_id = g.new_vp("int64_t")
+            g.vp.post_id.a[N:] = post_ids
+            g.vp.time = g.new_vp("int64_t")
+            g.vp.time.a[N:] = (_t0[alt] + times) // 1000
+        yield alt, g