History of wiki_topcats
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/wiki_topcats/__init__.py b/entries/wiki_topcats/__init__.py
index ff00fa9..c4512c0 100644
--- a/entries/wiki_topcats/__init__.py
+++ b/entries/wiki_topcats/__init__.py
@@ -30,7 +30,7 @@ tags = ['Informational', 'Web graph', 'Unweighted', 'Metadata']
url = ['https://snap.stanford.edu/data/wiki-topcats.html']
citation = [('H. Yin, A. R. Benson, J. Leskovec, and D. F. Gleich, "Local Higher-Order Graph Clustering." Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 555-564 (2017).', 'https://doi.org/10.1145/3097983.3098069'),
('C. Klymko, D. F. Gleich, and T. G. Kolda, "Using Triangles to Improve Community Detection in Directed Networks." Proceedings of the ASE BigData Conference (2014).', 'https://arxiv.org/abs/1404.5874')]
-icon_hash = None
+date_added = '2026-10-27'
upstream_license = None
upstream_prefix = 'https://snap.stanford.edu/data'
files = [(('wiki-topcats.txt.gz', 'wiki-topcats-page-names.txt.gz',
[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/wiki_topcats/__init__.py b/entries/wiki_topcats/__init__.py
index d173f11..ff00fa9 100644
--- a/entries/wiki_topcats/__init__.py
+++ b/entries/wiki_topcats/__init__.py
@@ -24,8 +24,8 @@ description = r"""A directed network of hyperlinks between articles of the Engli
The network has the following properties:
-- `name`: the title of the article.
-- `categories`: the top categories of the article (e.g. "Category:Skin_conditions_resulting_from_physical_factors")."""
+- (Node) `name`: the title of the article.
+- (Node) `categories`: the top categories of the article (e.g. "Category:Skin_conditions_resulting_from_physical_factors")."""
tags = ['Informational', 'Web graph', 'Unweighted', 'Metadata']
url = ['https://snap.stanford.edu/data/wiki-topcats.html']
citation = [('H. Yin, A. R. Benson, J. Leskovec, and D. F. Gleich, "Local Higher-Order Graph Clustering." Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 555-564 (2017).', 'https://doi.org/10.1145/3097983.3098069'),
[entries] New entry: wiki_topcats 0fffad5
diff --git a/entries/wiki_topcats/__init__.py b/entries/wiki_topcats/__init__.py
new file mode 100644
index 0000000..d173f11
--- /dev/null
+++ b/entries/wiki_topcats/__init__.py
@@ -0,0 +1,74 @@
+#! /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 hyperlinks among pages of top categories (2011)"
+description = r"""A directed network of hyperlinks between articles of the English Wikipedia, collected in September 2011 and distributed by the Stanford Network Analysis Project (SNAP) as `wiki-topcats`, as a benchmark for clustering with ground-truth communities. The network was constructed by taking the largest strongly connected component of the hyperlink network of Wikipedia, restricting it to the articles in the top categories (those with at least 100 articles), and taking the largest strongly connected component of the result. Nodes are articles, and an edge $i \to j$ means that article $i$ links to article $j$. The categories of the articles (which overlap, since an article can belong to several categories) are given as ground-truth communities; only the top categories are included.
+
+The network has the following properties:
+
+- `name`: the title of the article.
+- `categories`: the top categories of the article (e.g. "Category:Skin_conditions_resulting_from_physical_factors")."""
+tags = ['Informational', 'Web graph', 'Unweighted', 'Metadata']
+url = ['https://snap.stanford.edu/data/wiki-topcats.html']
+citation = [('H. Yin, A. R. Benson, J. Leskovec, and D. F. Gleich, "Local Higher-Order Graph Clustering." Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 555-564 (2017).', 'https://doi.org/10.1145/3097983.3098069'),
+ ('C. Klymko, D. F. Gleich, and T. G. Kolda, "Using Triangles to Improve Community Detection in Directed Networks." Proceedings of the ASE BigData Conference (2014).', 'https://arxiv.org/abs/1404.5874')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'https://snap.stanford.edu/data'
+files = [(('wiki-topcats.txt.gz', 'wiki-topcats-page-names.txt.gz',
+ 'wiki-topcats-categories.txt.gz'), 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):
+ import pandas
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ names = []
+ with open_upstream_file(name, fnames[1], "r") as f:
+ for i, line in enumerate(f):
+ idx, _, title = line.rstrip("\n").partition(" ")
+ assert int(idx) == i
+ names.append(title)
+ N = len(names)
+ with open_upstream_file(name, fnames[0], "r") as f:
+ E = pandas.read_csv(f, sep=" ", header=None, dtype="int64").to_numpy()
+ assert E.min() >= 0 and E.max() < N
+ g = Graph(directed=True)
+ g.add_vertex(N)
+ g.add_edge_list(E)
+ del E
+ g.vp.name = g.new_vp("string", vals=names)
+ del names
+ g.vp.categories = g.new_vp("vector<string>")
+ with open_upstream_file(name, fnames[2], "r") as f:
+ for line in f:
+ cat, _, members = line.rstrip("\n").partition(";")
+ for v in members.split():
+ g.vp.categories[int(v)].append(cat)
+ yield alt, g