logo Netzschleuder network catalog, repository, and centrifuge

History of memetracker

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/memetracker/__init__.py b/entries/memetracker/__init__.py
index 1f5857a..b3876dd 100644
--- a/entries/memetracker/__init__.py
+++ b/entries/memetracker/__init__.py
@@ -36,7 +36,7 @@ The networks have the following properties:
 tags = ['Informational', 'Web graph', 'Online', 'Unweighted', 'Multigraph', 'Timestamps', 'Metadata']
 url = 'https://snap.stanford.edu/data/memetracker9.html'
 citation = [('J. Leskovec, L. Backstrom, J. Kleinberg, "Meme-tracking and the Dynamics of the News Cycle." Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 497-506 (2009)', 'https://doi.org/10.1145/1557019.1557077')]
-icon_hash = None
+date_added = '2026-10-27'
 upstream_license = None
 # networks of more than about 300 million edges: only stored and served in the
 # gt format
[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/memetracker/__init__.py b/entries/memetracker/__init__.py
index fe678e3..1f5857a 100644
--- a/entries/memetracker/__init__.py
+++ b/entries/memetracker/__init__.py
@@ -30,9 +30,9 @@ A document listed several times (with the same URL) is a single node; the times
 
 The networks have the following properties:
 
-- `links`: `url`, the URL; `time`, the first time of publication of the document (-1 for URLs that are not documents of the data set).
-- `quotes`: `is_phrase`, whether the node is a phrase (otherwise a document); `text`, the URL of the document or the text of the phrase; `time`, the first time of publication of the document (-1 for phrases).
-- Edge `time`: the time of publication of the document (Unix time)."""
+- (Node) `links`: `url`, the URL; `time`, the first time of publication of the document (-1 for URLs that are not documents of the data set).
+- (Node) `quotes`: `is_phrase`, whether the node is a phrase (otherwise a document); `text`, the URL of the document or the text of the phrase; `time`, the first time of publication of the document (-1 for phrases).
+- (Edge) `time`: the time of publication of the document (Unix time)."""
 tags = ['Informational', 'Web graph', 'Online', 'Unweighted', 'Multigraph', 'Timestamps', 'Metadata']
 url = 'https://snap.stanford.edu/data/memetracker9.html'
 citation = [('J. Leskovec, L. Backstrom, J. Kleinberg, "Meme-tracking and the Dynamics of the News Cycle." Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 497-506 (2009)', 'https://doi.org/10.1145/1557019.1557077')]
[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/memetracker/__init__.py b/entries/memetracker/__init__.py
index a996517..fe678e3 100644
--- a/entries/memetracker/__init__.py
+++ b/entries/memetracker/__init__.py
@@ -109,7 +109,6 @@ def unix_time(ts):
 @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] Store the networks of more than 300 million edges of the new large entries only in the gt format by Tiago de Paula Peixoto 68260af
The networks of the large datasets added recently with more than about
300 million edges (published counts, or estimates where the networks
have not been parsed yet) are listed in `skip_conversion`, so that they
are not converted to GraphML, GML and CSV, which would take about 5 TB.
diff --git a/entries/memetracker/__init__.py b/entries/memetracker/__init__.py
index fe09740..a996517 100644
--- a/entries/memetracker/__init__.py
+++ b/entries/memetracker/__init__.py
@@ -38,6 +38,9 @@ url = 'https://snap.stanford.edu/data/memetracker9.html'
 citation = [('J. Leskovec, L. Backstrom, J. Kleinberg, "Meme-tracking and the Dynamics of the News Cycle." Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 497-506 (2009)', 'https://doi.org/10.1145/1557019.1557077')]
 icon_hash = None
 upstream_license = None
+# networks of more than about 300 million edges: only stored and served in the
+# gt format
+skip_conversion = ['links']
 upstream_prefix = 'https://snap.stanford.edu/data/bigdata/memetracker9'
 # Huge: 418 million hyperlinks and 211 million quotes of 97 million
 # documents, with URL and phrase strings for some hundreds of millions of
[entries] New entry: memetracker by Tiago de Paula Peixoto fac2ed8
diff --git a/entries/memetracker/__init__.py b/entries/memetracker/__init__.py
new file mode 100644
index 0000000..fe09740
--- /dev/null
+++ b/entries/memetracker/__init__.py
@@ -0,0 +1,173 @@
+#! /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 hashlib
+
+from .. import *
+
+
+title = "MemeTracker news and blog hyperlinks and quotes (2008-2009)"
+description = """Networks of the blog posts and news articles collected by the MemeTracker project of J. Leskovec, L. Backstrom and J. Kleinberg from August 2008 to April 2009, which follows the quotes and phrases ("memes") that spread through the online media. The source lists, for each of 96,608,034 documents (blog posts or news articles), its URL, its time of publication, the phrases it quotes (210,999,824 in total), and the URLs of its hyperlinks (418,237,269 in total).
+
+- `links`: a directed network of URLs, in which an edge from A to B means that the document A has a hyperlink to B, with the time of publication of A. The linked URLs need not be documents of the data set (e.g. images, or pages of other websites).
+- `quotes`: a bipartite network of the documents and the phrases they quote, with the time of publication of the document. A document is connected to a phrase once for each time it is listed among its quotes.
+
+A document listed several times (with the same URL) is a single node; the times of its occurrences are the times of their edges. The phrases are given by the source in lower case, with punctuation removed. The times are those of the source (whose time zone is not stated), here as Unix time as if they were UTC.
+
+The networks have the following properties:
+
+- `links`: `url`, the URL; `time`, the first time of publication of the document (-1 for URLs that are not documents of the data set).
+- `quotes`: `is_phrase`, whether the node is a phrase (otherwise a document); `text`, the URL of the document or the text of the phrase; `time`, the first time of publication of the document (-1 for phrases).
+- Edge `time`: the time of publication of the document (Unix time)."""
+tags = ['Informational', 'Web graph', 'Online', 'Unweighted', 'Multigraph', 'Timestamps', 'Metadata']
+url = 'https://snap.stanford.edu/data/memetracker9.html'
+citation = [('J. Leskovec, L. Backstrom, J. Kleinberg, "Meme-tracking and the Dynamics of the News Cycle." Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 497-506 (2009)', 'https://doi.org/10.1145/1557019.1557077')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'https://snap.stanford.edu/data/bigdata/memetracker9'
+# Huge: 418 million hyperlinks and 211 million quotes of 97 million
+# documents, with URL and phrase strings for some hundreds of millions of
+# nodes (a download of 14 GB)
+huge = True
+months = ['2008-08', '2008-09', '2008-10', '2008-11', '2008-12', '2009-01',
+          '2009-02', '2009-03', '2009-04']
+files = [(tuple(f'quotes_{m}.txt.gz' for m in months), 'links', None),
+         (tuple(f'quotes_{m}.txt.gz' for m in months), 'quotes', None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+# For checks only: if set, only (about) this many documents are read from
+# each file
+_check_rows = None
+
+def read_documents(name, fname, kind):
+    """The documents of a file, in chunks of lists (urls, times, targets),
+    where the targets of each document are the URLs of its hyperlinks
+    (kind "L") or its quotes (kind "Q")."""
+    urls, times, targets = [], [], []
+    url, t, tg = None, None, []
+    n = 0
+    kind = kind.encode()
+    with open_upstream_file(name, fname, "rb") as f:
+        for line in f:
+            if line[:2] == b"P\t":
+                if url is not None:
+                    urls.append(url)
+                    times.append(t)
+                    targets.append(tg)
+                    n += 1
+                    if len(urls) >= 1 << 20:
+                        yield urls, times, targets
+                        urls, times, targets = [], [], []
+                    if _check_rows is not None and n >= _check_rows:
+                        url = None
+                        break
+                url, t, tg = line[2:].rstrip(b"\r\n"), None, []
+            elif line[:2] == b"T\t":
+                t = line[2:].rstrip(b"\r\n")
+            elif line[:1] == kind and line[1:2] == b"\t":
+                tg.append(line[2:].rstrip(b"\r\n"))
+    if url is not None:
+        urls.append(url)
+        times.append(t)
+        targets.append(tg)
+    if urls:
+        yield urls, times, targets
+
+def keys(strings, prefix):
+    """128-bit hashes of the strings (with a prefix that separates kinds of
+    nodes), as a numpy array of 16-byte strings, for sorting and
+    searching."""
+    return numpy.frombuffer(b"".join(hashlib.blake2b(prefix + s, digest_size=16).digest()
+                                     for s in strings), dtype="S16")
+
+def unix_time(ts):
+    "Unix time of times like b'2008-08-01 00:00:00' (-1 if missing)."
+    return numpy.array([t.decode().replace(" ", "T") if t else "NaT" for t in ts],
+                       dtype="datetime64[s]").astype("int64").clip(-1)
+
+@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
+        kind = "L" if alt == "links" else "Q"
+        # the hyperlinks point to URLs (as the documents); the quotes to
+        # phrases, a separate kind of node
+        tprefix = b"U" if kind == "L" else b"Q"
+
+        # First pass: the nodes (sorted keys)
+        allk = []
+        for fname in fnames:
+            for urls, times, targets in read_documents(name, fname, kind):
+                ks = [keys(urls, b"U"),
+                      keys([x for tg in targets for x in tg], tprefix)]
+                allk.append(numpy.unique(numpy.concatenate(ks)))
+                if len(allk) > 16:
+                    allk = [numpy.unique(numpy.concatenate(allk))]
+        allk = numpy.unique(numpy.concatenate(allk))
+        N = len(allk)
+
+        # Second pass: the edges, and the strings and times of the nodes
+        g = Graph(directed=(kind == "L"))
+        g.add_vertex(N)
+        g.ep.time = g.new_ep("int64_t")
+        text = g.new_vp("string")
+        vtime = g.new_vp("int64_t", val=-1)
+        named = numpy.zeros(N, dtype="bool")
+        is_target = numpy.zeros(N, dtype="bool")
+        for fname in fnames:
+            for urls, times, targets in read_documents(name, fname, kind):
+                src = numpy.searchsorted(allk, keys(urls, b"U"))
+                t = unix_time(times)
+                flat = [x for tg in targets for x in tg]
+                tgt = numpy.searchsorted(allk, keys(flat, tprefix))
+                cnt = numpy.array([len(tg) for tg in targets], dtype="int64")
+                g.add_edge_list(numpy.column_stack([numpy.repeat(src, cnt), tgt,
+                                                    numpy.repeat(t, cnt)]),
+                                eprops=[g.ep.time])
+                # the first time of publication of each document
+                vt = vtime.a
+                order = numpy.argsort(t, kind="stable")
+                for v, x in zip(src[order], t[order]):
+                    if x >= 0 and (vt[v] < 0 or x < vt[v]):
+                        vt[v] = x
+                for vs, ss in [(src, urls), (tgt, flat)]:
+                    for i in numpy.flatnonzero(~named[vs]):
+                        v = vs[i]
+                        if not named[v]:
+                            text[v] = ss[i].decode("utf-8", "replace")
+                            named[v] = True
+                is_target[tgt] = True
+                del src, tgt, flat, t, cnt
+        assert named.all()
+        if kind == "L":
+            g.vp.url = text
+            g.vp.time = vtime
+        else:
+            # phrases: nodes reached by quotes (documents are never quoted,
+            # since their keys have another prefix)
+            g.vp.is_phrase = g.new_vp("bool", vals=is_target)
+            g.vp.text = text
+            g.vp.time = vtime
+        yield alt, g