logo Netzschleuder network catalog, repository, and centrifuge

History of congress_twitter

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/congress_twitter/__init__.py b/entries/congress_twitter/__init__.py
index 48f9995..3002426 100644
--- a/entries/congress_twitter/__init__.py
+++ b/entries/congress_twitter/__init__.py
@@ -35,7 +35,7 @@ url = ['https://snap.stanford.edu/data/congress-twitter.html',
        'https://github.com/gsprint23/CongressionalTwitterNetwork']
 citation = [('C. G. Fink, N. Omodt, S. Zinnecker, and G. Sprint, "A Congressional Twitter network dataset quantifying pairwise probability of influence." Data in Brief 50, 109521 (2023).', 'https://doi.org/10.1016/j.dib.2023.109521'),
             ('C. G. Fink, K. Fullin, G. Gutierrez, N. Omodt, S. Zinnecker, G. Sprint, and S. McCulloch, "A centrality measure for quantifying spread on weighted, directed networks." Physica A 626, 129083 (2023).', 'https://doi.org/10.1016/j.physa.2023.129083')]
-icon_hash = None
+date_added = '2026-10-27'
 upstream_license = ('MIT License', 'https://github.com/gsprint23/CongressionalTwitterNetwork/blob/205ca40d973e13944051e1e44240d005a9b1a1bc/LICENSE.txt')
 upstream_prefix = 'https://raw.githubusercontent.com/gsprint23/CongressionalTwitterNetwork/205ca40d973e13944051e1e44240d005a9b1a1bc'
 files = [('congress_network_data.json', None, 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/congress_twitter/__init__.py b/entries/congress_twitter/__init__.py
index 2c86c94..48f9995 100644
--- a/entries/congress_twitter/__init__.py
+++ b/entries/congress_twitter/__init__.py
@@ -28,8 +28,8 @@ The authors left out the members with fewer than 100 tweets in the period, and s
 
 The network has the following properties:
 
-- `name`: the Twitter user name of the member.
-- Edge `weight`: the fraction of the tweets of the source member that the target member retweeted, quote tweeted, replied to or mentioned."""
+- (Node) `name`: the Twitter user name of the member.
+- (Edge) `weight`: the fraction of the tweets of the source member that the target member retweeted, quote tweeted, replied to or mentioned."""
 tags = ['Social', 'Online', 'Political', 'Weighted']
 url = ['https://snap.stanford.edu/data/congress-twitter.html',
        'https://github.com/gsprint23/CongressionalTwitterNetwork']
[entries] New entry: congress_twitter by Tiago de Paula Peixoto 9b1c355
diff --git a/entries/congress_twitter/__init__.py b/entries/congress_twitter/__init__.py
new file mode 100644
index 0000000..2c86c94
--- /dev/null
+++ b/entries/congress_twitter/__init__.py
@@ -0,0 +1,69 @@
+#! /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 *
+
+import json
+
+title = "US Congress Twitter influence network (2022)"
+description = r"""A directed network of influence on Twitter among the members of the 117th United States Congress (House of Representatives and Senate), collected by C. G. Fink, G. Sprint and collaborators from the Twitter API. It is based on the tweets of the members between February 9 and June 9, 2022. Nodes are members of Congress, identified by their Twitter user names. An edge points from member A to member B if B retweeted, quote tweeted, replied to or mentioned A at least once (a mention is not counted again if it is also a reply, retweet or quote of the same member). The weight of the edge is the number of such interactions divided by the number of tweets of A in the period, an empirical estimate of the probability that a tweet of A is passed on by B.
+
+The authors left out the members with fewer than 100 tweets in the period, and self-interactions. Only the normalized weights are given, not the numbers of interactions or tweets, and the tweets themselves can only be retrieved (rehydrated) through the Twitter API, so the network cannot be recomputed without that threshold.
+
+The network has the following properties:
+
+- `name`: the Twitter user name of the member.
+- Edge `weight`: the fraction of the tweets of the source member that the target member retweeted, quote tweeted, replied to or mentioned."""
+tags = ['Social', 'Online', 'Political', 'Weighted']
+url = ['https://snap.stanford.edu/data/congress-twitter.html',
+       'https://github.com/gsprint23/CongressionalTwitterNetwork']
+citation = [('C. G. Fink, N. Omodt, S. Zinnecker, and G. Sprint, "A Congressional Twitter network dataset quantifying pairwise probability of influence." Data in Brief 50, 109521 (2023).', 'https://doi.org/10.1016/j.dib.2023.109521'),
+            ('C. G. Fink, K. Fullin, G. Gutierrez, N. Omodt, S. Zinnecker, G. Sprint, and S. McCulloch, "A centrality measure for quantifying spread on weighted, directed networks." Physica A 626, 129083 (2023).', 'https://doi.org/10.1016/j.physa.2023.129083')]
+icon_hash = None
+upstream_license = ('MIT License', 'https://github.com/gsprint23/CongressionalTwitterNetwork/blob/205ca40d973e13944051e1e44240d005a9b1a1bc/LICENSE.txt')
+upstream_prefix = 'https://raw.githubusercontent.com/gsprint23/CongressionalTwitterNetwork/205ca40d973e13944051e1e44240d005a9b1a1bc'
+files = [('congress_network_data.json', 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):
+    name = __name__.split(".")[-1]
+    for fname, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        with open_upstream_file(name, fname, "r") as f:
+            d, = json.load(f)
+        names = d["usernameList"]
+        g = Graph(directed=True)
+        g.add_vertex(len(names))
+        g.vp.name = g.new_vp("string", vals=names)
+        g.ep.weight = g.new_ep("double")
+        E = [(u, v, w) for u, (vs, ws) in enumerate(zip(d["outList"], d["outWeight"]))
+             for v, w in zip(vs, ws)]
+        g.add_edge_list(E, eprops=[g.ep.weight])
+        # the in-lists give the same edges
+        Ein = sorted((u, v, w) for v, (us, ws) in enumerate(zip(d["inList"], d["inWeight"]))
+                     for u, w in zip(us, ws))
+        assert sorted(E) == Ein
+        yield alt, g