logo Netzschleuder network catalog, repository, and centrifuge

History of cow_signed_relations

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] Remove superfluous details of the upstream distribution from the descriptions by Tiago de Paula Peixoto dc07aa0
The descriptions mentioned incidental details of how the upstream data
are made available: the file formats (CSV, JSON, XML, GEXF, SBML, HIF,
Pajek, UCINET, ...), file names, where the files were published or
obtained from (Zenodo, figshare, Kaggle, the Pajek datasets page, the
Internet Archive), and that some networks are only available in the gt
format. These are left out; caveats about the data themselves are kept,
referring to "the data" instead of "the file". The description of
sp_baboons now lists its properties instead of the upstream columns,
and says that events without a recipient are left out.
diff --git a/entries/cow_signed_relations/__init__.py b/entries/cow_signed_relations/__init__.py
index dc104ee..52c436d 100644
--- a/entries/cow_signed_relations/__init__.py
+++ b/entries/cow_signed_relations/__init__.py
@@ -21,7 +21,7 @@ import re
 from .. import *
 
 title = "Correlates of War signed international relations (1946-1999)"
-description = r"""A temporal signed network of relations between countries after the Second World War, constructed by P. Doreian and A. Mrvar from the Correlates of War data to study structural balance in international relations. The data are split in 51 overlapping four-year time windows, from 1946–1949 to 1996–1999, shifted by one year. The networks were distributed by A. Mrvar on the Pajek website, and collected by S. Aref in a collection of signed networks used to compute the frustration index (Aref and Wilson, 2019).
+description = r"""A temporal signed network of relations between countries after the Second World War, constructed by P. Doreian and A. Mrvar from the Correlates of War data to study structural balance in international relations. The data are split in 51 overlapping four-year time windows, from 1946–1949 to 1996–1999, shifted by one year. The networks were collected by S. Aref in a collection of signed networks used to compute the frustration index (Aref and Wilson, 2019).
 
 Nodes are countries, and an undirected edge between two countries has sign $+1$ for a positive relation (joint membership in alliances, unions of states, or inter-governmental agreements) and $-1$ for a negative relation (being at war, being in conflict without military involvement, or having border disputes or sharp disagreements on ideology or policy) during the time window. Each network contains only the countries with at least one relation in its window, from 64 countries and 362 relations in 1946–1949 to 151 countries and 1,247 relations in 1996–1999. The networks are named after their window (e.g. `1946-1949`).
 
@@ -30,7 +30,7 @@ The networks have the following properties:
 - (Node) `name` (vertices): the Correlates of War three-letter abbreviation of the country (e.g. `USA`, `RUS`).
 - (Edge) `sign` (edges): $+1$ for a positive and $-1$ for a negative relation.
 
-The source also contains a separate copy of the first window (`N46.net`), the signed triads that Doreian and Mrvar use as balance "fragments", and an undocumented 21-node directed signed network (`haddate1.net`); these are not included."""
+The source also contains a separate copy of the first window, the signed triads that Doreian and Mrvar use as balance "fragments", and an undocumented 21-node directed signed network; these are not included."""
 tags = ['Political', 'Conflict', 'Signed', 'Temporal', 'Metadata']
 url = ['https://doi.org/10.6084/m9.figshare.5700832',
        'http://mrvar.fdv.uni-lj.si/pajek/SVG/CoW/']
[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/cow_signed_relations/__init__.py b/entries/cow_signed_relations/__init__.py
index 9fb3059..dc104ee 100644
--- a/entries/cow_signed_relations/__init__.py
+++ b/entries/cow_signed_relations/__init__.py
@@ -38,7 +38,7 @@ citation = [('P. Doreian and A. Mrvar, "Structural balance and signed internatio
             ('S. Aref and M. C. Wilson, "Balance and frustration in signed networks." J. Complex Networks 7(2), 163–189 (2019)', 'https://doi.org/10.1093/comnet/cny015'),
             ('J. Pevehouse, T. Nordstrom and K. Warnke, "The Correlates of War 2 international governmental organizations data version 2.0." Conflict Management and Peace Science 21(2), 101–119 (2004)', 'https://doi.org/10.1080/07388940490463933'),
             ('S. Aref, "Signed networks from sociology and political science, systems biology, international relations, finance, and computational chemistry." Figshare (2017)', 'https://doi.org/10.6084/m9.figshare.5700832')]
-icon_hash = None
+date_added = '2026-10-25'
 upstream_license = ("Creative Commons Attribution 4.0 International (CC BY 4.0)",
                     "https://creativecommons.org/licenses/by/4.0/")
 # figshare's ndownloader refuses some automated downloads, so the 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/cow_signed_relations/__init__.py b/entries/cow_signed_relations/__init__.py
index b7b43a9..9fb3059 100644
--- a/entries/cow_signed_relations/__init__.py
+++ b/entries/cow_signed_relations/__init__.py
@@ -27,8 +27,8 @@ Nodes are countries, and an undirected edge between two countries has sign $+1$
 
 The networks have the following properties:
 
-- `name` (vertices): the Correlates of War three-letter abbreviation of the country (e.g. `USA`, `RUS`).
-- `sign` (edges): $+1$ for a positive and $-1$ for a negative relation.
+- (Node) `name` (vertices): the Correlates of War three-letter abbreviation of the country (e.g. `USA`, `RUS`).
+- (Edge) `sign` (edges): $+1$ for a positive and $-1$ for a negative relation.
 
 The source also contains a separate copy of the first window (`N46.net`), the signed triads that Doreian and Mrvar use as balance "fragments", and an undocumented 21-node directed signed network (`haddate1.net`); these are not included."""
 tags = ['Political', 'Conflict', 'Signed', 'Temporal', 'Metadata']
[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/cow_signed_relations/__init__.py b/entries/cow_signed_relations/__init__.py
index d07c0a1..b7b43a9 100644
--- a/entries/cow_signed_relations/__init__.py
+++ b/entries/cow_signed_relations/__init__.py
@@ -84,7 +84,6 @@ def _parse_window(f, window):
 @coerce_props()
 @annotate()
 def parse(alts=None):
-    global files
     name = __name__.split(".")[-1]
     for fname, alt, fmt in files:
         if alts is not None and alt not in alts:
[entries] Move unavailable upstream sources to verified alternatives by Tiago de Paula Peixoto 2137af6
The upstream sources of these entries are gone, moved, or refuse automated
downloads; each now downloads the same data (byte-identical to the cached
files, or for board_directors, identical apart from line endings) from:

- add_health: the Wayback Machine (Moreno's site, as its sibling entries)
- board_directors: T. Opsahl's site (opsahl.co.uk)
- copenhagen, cow_signed_relations, fullerene_structures,
  german_power_grid: figshare's API (its downloader refuses the server)
- drosophila_flybi: the same address, without a doubled slash
- dutch_criticism: V. Batagelj's repository of Pajek data on GitHub
- fly_larva: the copy of the supplementary files in Europe PMC
- foursquare: the authors' Google Drive file
- game_thrones, microsoft_concept, un_migrations: pinned Wayback Machine
  snapshots
- internet_top_pop: the Topology Zoo repository on GitHub
- scotus_majority: Harvard Dataverse and Wayback Machine snapshots
diff --git a/entries/cow_signed_relations/__init__.py b/entries/cow_signed_relations/__init__.py
index 3ae0b0a..d07c0a1 100644
--- a/entries/cow_signed_relations/__init__.py
+++ b/entries/cow_signed_relations/__init__.py
@@ -41,7 +41,9 @@ citation = [('P. Doreian and A. Mrvar, "Structural balance and signed internatio
 icon_hash = None
 upstream_license = ("Creative Commons Attribution 4.0 International (CC BY 4.0)",
                     "https://creativecommons.org/licenses/by/4.0/")
-upstream_prefix = 'https://ndownloader.figshare.com/files'
+# figshare's ndownloader refuses some automated downloads, so the files
+# are downloaded through figshare's API (the same files, by id)
+upstream_prefix = 'https://api.figshare.com/v2/file/download'
 
 files = [("21172485:zip:International Relations/Correlates of War 1946-1996 (51 four-year sliding time windows)/Cow.net",
           f"{1900 + y}-{1903 + y}", "pajek") for y in range(46, 97)]
[entries] New entry: cow_signed_relations by Tiago de Paula Peixoto 0722c8e
diff --git a/entries/cow_signed_relations/__init__.py b/entries/cow_signed_relations/__init__.py
new file mode 100644
index 0000000..3ae0b0a
--- /dev/null
+++ b/entries/cow_signed_relations/__init__.py
@@ -0,0 +1,92 @@
+#! /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/>.
+
+import re
+
+from .. import *
+
+title = "Correlates of War signed international relations (1946-1999)"
+description = r"""A temporal signed network of relations between countries after the Second World War, constructed by P. Doreian and A. Mrvar from the Correlates of War data to study structural balance in international relations. The data are split in 51 overlapping four-year time windows, from 1946–1949 to 1996–1999, shifted by one year. The networks were distributed by A. Mrvar on the Pajek website, and collected by S. Aref in a collection of signed networks used to compute the frustration index (Aref and Wilson, 2019).
+
+Nodes are countries, and an undirected edge between two countries has sign $+1$ for a positive relation (joint membership in alliances, unions of states, or inter-governmental agreements) and $-1$ for a negative relation (being at war, being in conflict without military involvement, or having border disputes or sharp disagreements on ideology or policy) during the time window. Each network contains only the countries with at least one relation in its window, from 64 countries and 362 relations in 1946–1949 to 151 countries and 1,247 relations in 1996–1999. The networks are named after their window (e.g. `1946-1949`).
+
+The networks have the following properties:
+
+- `name` (vertices): the Correlates of War three-letter abbreviation of the country (e.g. `USA`, `RUS`).
+- `sign` (edges): $+1$ for a positive and $-1$ for a negative relation.
+
+The source also contains a separate copy of the first window (`N46.net`), the signed triads that Doreian and Mrvar use as balance "fragments", and an undocumented 21-node directed signed network (`haddate1.net`); these are not included."""
+tags = ['Political', 'Conflict', 'Signed', 'Temporal', 'Metadata']
+url = ['https://doi.org/10.6084/m9.figshare.5700832',
+       'http://mrvar.fdv.uni-lj.si/pajek/SVG/CoW/']
+citation = [('P. Doreian and A. Mrvar, "Structural balance and signed international relations." Journal of Social Structure 16(1), 1–49 (2015)', 'https://doi.org/10.21307/joss-2019-012'),
+            ('S. Aref and M. C. Wilson, "Balance and frustration in signed networks." J. Complex Networks 7(2), 163–189 (2019)', 'https://doi.org/10.1093/comnet/cny015'),
+            ('J. Pevehouse, T. Nordstrom and K. Warnke, "The Correlates of War 2 international governmental organizations data version 2.0." Conflict Management and Peace Science 21(2), 101–119 (2004)', 'https://doi.org/10.1080/07388940490463933'),
+            ('S. Aref, "Signed networks from sociology and political science, systems biology, international relations, finance, and computational chemistry." Figshare (2017)', 'https://doi.org/10.6084/m9.figshare.5700832')]
+icon_hash = None
+upstream_license = ("Creative Commons Attribution 4.0 International (CC BY 4.0)",
+                    "https://creativecommons.org/licenses/by/4.0/")
+upstream_prefix = 'https://ndownloader.figshare.com/files'
+
+files = [("21172485:zip:International Relations/Correlates of War 1946-1996 (51 four-year sliding time windows)/Cow.net",
+          f"{1900 + y}-{1903 + y}", "pajek") for y in range(46, 97)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+def _parse_window(f, window):
+    # Pajek file with one "*Edges :<k> "<label>"" section per time window
+    names = {}
+    edges = []
+    cur = None
+    for line in f:
+        line = line.strip()
+        if not line or line.startswith("*Vertices"):
+            continue
+        if line.startswith("*Edges"):
+            cur = re.match(r'\*Edges :(\d+)', line).group(1)
+            continue
+        if cur is None:
+            m = re.match(r'(\d+)\s+"([^"]*)"', line)
+            names[int(m.group(1))] = m.group(2)
+        elif cur == window:
+            u, v, s = line.split()
+            edges.append((int(u), int(v), int(s)))
+    ids = sorted(set(x for e in edges for x in e[:2]))
+    idx = {x: i for i, x in enumerate(ids)}
+    g = Graph(directed=False)
+    g.add_vertex(len(ids))
+    g.vp.name = g.new_vp("string", vals=[names[x] for x in ids])
+    g.ep.sign = g.new_ep("int")
+    g.add_edge_list([(idx[u], idx[v], s) for u, v, s in edges],
+                    eprops=[g.ep.sign])
+    return g
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+    global files
+    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:
+            g = _parse_window(f, alt[2:4])
+        yield alt, g