logo Netzschleuder network catalog, repository, and centrifuge

History of telegram_channels_graph

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/telegram_channels_graph/__init__.py b/entries/telegram_channels_graph/__init__.py
index f299da3..9438a67 100644
--- a/entries/telegram_channels_graph/__init__.py
+++ b/entries/telegram_channels_graph/__init__.py
@@ -46,7 +46,7 @@ citation = [('S. Shapovalova, A. Sofiienko, "Telegram channels graph dataset." Z
              'https://doi.org/10.5281/zenodo.14749767')]
 upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)',
                     'https://creativecommons.org/licenses/by/4.0/')
-icon_hash = None
+date_added = '2026-10-31'
 
 # Zenodo record of version 1.0.0
 upstream_prefix = 'https://zenodo.org/records/14749767/files'
[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/telegram_channels_graph/__init__.py b/entries/telegram_channels_graph/__init__.py
index 8448509..f299da3 100644
--- a/entries/telegram_channels_graph/__init__.py
+++ b/entries/telegram_channels_graph/__init__.py
@@ -31,8 +31,15 @@ Both networks contain all channels of the dataset. For about half of them (133,6
 
 The networks have the following properties:
 
-- Nodes: `channel_id`, the id of the channel on Telegram; `has_record`, whether the channel is in the file of channels; `name`, its username (its address is `https://t.me/<name>`; empty for some); `title`; `created`, the time of creation of the channel (Unix time); `snapshot`, the time of the snapshot of the statistics (Unix time; -1 if there are none); `top_lang`, the ISO code of the main language of its publications (two codes separated by a comma for ties; empty if unknown); `p90_views` and `p90_forwards`, the 90th percentiles of the numbers of views and forwards of its publications at the time of the snapshot (NaN if unknown).
-- Edges: `count`, the number of forwarded publications (`forwards`) or of mentions (`mentions`)."""
+- (Node) `channel_id`: the id of the channel on Telegram.
+- (Node) `has_record`: whether the channel is in the file of channels.
+- (Node) `name`: its username (its address is `https://t.me/<name>`; empty for some).
+- (Node) `title`.
+- (Node) `created`: the time of creation of the channel (Unix time).
+- (Node) `snapshot`: the time of the snapshot of the statistics (Unix time; -1 if there are none).
+- (Node) `top_lang`: the ISO code of the main language of its publications (two codes separated by a comma for ties; empty if unknown).
+- (Node) `p90_views` and `p90_forwards`: the 90th percentiles of the numbers of views and forwards of its publications at the time of the snapshot (NaN if unknown).
+- (Edge) `count`: the number of forwarded publications (`forwards`) or of mentions (`mentions`)."""
 tags = ['Social', 'Online', 'Communication', 'Weighted', 'Multigraph', 'Metadata']
 url = 'https://doi.org/10.5281/zenodo.14749767'
 citation = [('S. Shapovalova, A. Sofiienko, "Telegram channels graph dataset." Zenodo (2025)',
[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/telegram_channels_graph/__init__.py b/entries/telegram_channels_graph/__init__.py
index 4e2e51b..8448509 100644
--- a/entries/telegram_channels_graph/__init__.py
+++ b/entries/telegram_channels_graph/__init__.py
@@ -59,7 +59,6 @@ def unix(s):
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     name = __name__.split(".")[-1]
     for (fchan, fedges), alt, fmt in files:
         if alts is not None and alt not in alts:
[entries] New entry: telegram_channels_graph by Tiago de Paula Peixoto cc0c1c5
diff --git a/entries/telegram_channels_graph/__init__.py b/entries/telegram_channels_graph/__init__.py
new file mode 100644
index 0000000..4e2e51b
--- /dev/null
+++ b/entries/telegram_channels_graph/__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/>.
+
+from .. import *
+import pandas
+
+title = "Telegram channels graph (2015-2024)"
+description = """Networks of public Telegram channels, from the dataset of Shapovalova and Sofiienko, who collected 264,777 channels and their publications through the Telegram API. Each node is a channel, and there are two networks:
+
+- `forwards`: a directed edge from channel u to channel v means that publications of u were forwarded to v (v republished posts of u), with the number of forwarded publications as weight (2,207,614 edges, including 21,140 self-loops).
+- `mentions`: a directed edge from channel u to channel v means that publications of u mention v through a URL (a link to the channel or to one of its posts), with the number of mentions as weight (8,046,017 edges). The file contains repeated pairs of channels (933,000 of the edges duplicate a pair, with their own counts), which are kept as multiple edges, as they are.
+
+The direction follows the columns `FromId` and `ToId` of the files (in `forwards`, e.g., the news agency RIA Novosti is the source of 133,600 forwarded publications, and the target of 45).
+
+Both networks contain all channels of the dataset. For about half of them (133,603), the authors also give the 90th percentile of the views and of the forwards of their publications, and their main language (determined with fastText), at the time of a snapshot. A few channels (947) appear twice in the file of channels, with two main languages (ties), which are both kept. The mentions are made by 13,013 channels that are not in the file of channels; they are included as nodes without attributes (`has_record` false). The time range of the data is not stated; the channels were created from September 2015 to October 2024, and the snapshots were taken from 2015 to October 2024.
+
+The networks have the following properties:
+
+- Nodes: `channel_id`, the id of the channel on Telegram; `has_record`, whether the channel is in the file of channels; `name`, its username (its address is `https://t.me/<name>`; empty for some); `title`; `created`, the time of creation of the channel (Unix time); `snapshot`, the time of the snapshot of the statistics (Unix time; -1 if there are none); `top_lang`, the ISO code of the main language of its publications (two codes separated by a comma for ties; empty if unknown); `p90_views` and `p90_forwards`, the 90th percentiles of the numbers of views and forwards of its publications at the time of the snapshot (NaN if unknown).
+- Edges: `count`, the number of forwarded publications (`forwards`) or of mentions (`mentions`)."""
+tags = ['Social', 'Online', 'Communication', 'Weighted', 'Multigraph', 'Metadata']
+url = 'https://doi.org/10.5281/zenodo.14749767'
+citation = [('S. Shapovalova, A. Sofiienko, "Telegram channels graph dataset." Zenodo (2025)',
+             'https://doi.org/10.5281/zenodo.14749767')]
+upstream_license = ('Creative Commons Attribution 4.0 International (CC BY 4.0)',
+                    'https://creativecommons.org/licenses/by/4.0/')
+icon_hash = None
+
+# Zenodo record of version 1.0.0
+upstream_prefix = 'https://zenodo.org/records/14749767/files'
+ZIP = 'TelegramChannelsGraphDataset.zip'
+files = [((f'{ZIP}:Channels.csv', f'{ZIP}:Forwards.csv'), 'forwards', None),
+         ((f'{ZIP}:Channels.csv', f'{ZIP}:Mentions.csv'), 'mentions', None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+def unix(s):
+    t = pandas.to_datetime(s, format="%Y-%m-%d %H:%M:%S", utc=True)
+    return ((t - pandas.Timestamp(0, tz="UTC")) // pandas.Timedelta(seconds=1)).astype("int64").values
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    name = __name__.split(".")[-1]
+    for (fchan, fedges), alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        with open_upstream_file(name, fchan, "rb") as f:
+            c = pandas.read_csv(f, sep="\t", dtype=str, keep_default_na=False)
+        # channels listed twice differ only in their main language (ties)
+        lang = c.groupby("Id", sort=False).TopLang.agg(
+            lambda x: ",".join(l for l in dict.fromkeys(x) if l))
+        c = c.drop_duplicates("Id").set_index("Id")
+        c["TopLang"] = lang
+        with open_upstream_file(name, fedges, "rb") as f:
+            d = pandas.read_csv(f, sep="\t", dtype="int64")
+        ids = c.index.astype("int64").values
+        extra = numpy.setdiff1d(numpy.union1d(d.FromId.values, d.ToId.values), ids)
+        allids = numpy.concatenate((ids, extra))
+        order = numpy.argsort(allids)
+        pos = numpy.searchsorted(allids, d[["FromId", "ToId"]].values, sorter=order)
+        e = order[pos]
+
+        g = Graph(directed=True)
+        g.add_vertex(len(allids))
+        n = len(ids)
+        g.vp.channel_id = g.new_vp("int64_t")
+        g.vp.channel_id.a = allids
+        g.vp.has_record = g.new_vp("bool")
+        g.vp.has_record.a[:n] = True
+        g.vp.name = g.new_vp("string")
+        g.vp.title = g.new_vp("string")
+        g.vp.top_lang = g.new_vp("string")
+        for i, (nm, tt, lg) in enumerate(zip(c.Name, c.Title, c.TopLang)):
+            g.vp.name[i] = nm
+            g.vp.title[i] = tt
+            g.vp.top_lang[i] = lg
+        g.vp.created = g.new_vp("int64_t", val=-1)
+        g.vp.created.a[:n] = unix(c.CreatedAt)
+        g.vp.snapshot = g.new_vp("int64_t", val=-1)
+        snap = unix(c.SnapshotAt)
+        has = snap > 0
+        g.vp.snapshot.a[:n] = numpy.where(has, snap, -1)
+        for col, pn in [("P90Views", "p90_views"), ("P90Forwards", "p90_forwards")]:
+            p = g.new_vp("double", val=numpy.nan)
+            p.a[:n] = numpy.where(has, c[col].astype("float64").values, numpy.nan)
+            g.vp[pn] = p
+        g.ep.count = g.new_ep("int64_t")
+        g.add_edge_list(numpy.column_stack((e, d.Count.values)), eprops=[g.ep.count])
+        yield alt, g