logo Netzschleuder network catalog, repository, and centrifuge

History of crime

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/crime/__init__.py b/entries/crime/__init__.py
index a896231..026e62b 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -32,7 +32,7 @@ The network has the following properties:
 tags = ['Social', 'Offline', 'Unweighted', 'Metadata']
 url = 'https://web.archive.org/web/20210115130726/http://moreno.ss.uci.edu/data.html#crime'
 citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
-icon_hash = '57fe7bb68cf714f319c3ac2a'
+date_added = '2020-08-11'
 upstream_license = None
 upstream_prefix = 'https://web.archive.org/web/20210115130726id_/http://moreno.ss.uci.edu'
 files = [(('crime.dat', 'sex.dat'), 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/crime/__init__.py b/entries/crime/__init__.py
index 69459de..a896231 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -25,8 +25,10 @@ The network is bipartite: an undirected edge connects an individual to a crime e
 
 The network has the following properties:
 
-- Nodes: `is_crime`, whether the node is a crime event (otherwise, it is an individual); `name`, the name of the individual (with the family name first, without a space), or the identifier of the crime event (two identifiers, 930011 and 930019, are each used for two different crime events); `sex`, the sex of the individual ("F" or "M"; empty for crime events). The coding of sex is not documented in the source (it is given as 0 or 1); it is inferred here from the first names.
-- Edges: `role`, the role of the individual in the crime event ("victim", "suspect", "witness", or "victim and suspect")."""
+- (Node) `is_crime`: whether the node is a crime event (otherwise, it is an individual).
+- (Node) `name`: the name of the individual (with the family name first, without a space), or the identifier of the crime event (two identifiers, 930011 and 930019, are each used for two different crime events).
+- (Node) `sex`: the sex of the individual ("F" or "M"; empty for crime events). The coding of sex is not documented in the source (it is given as 0 or 1); it is inferred here from the first names.
+- (Edge) `role`: the role of the individual in the crime event ("victim", "suspect", "witness", or "victim and suspect")."""
 tags = ['Social', 'Offline', 'Unweighted', 'Metadata']
 url = 'https://web.archive.org/web/20210115130726/http://moreno.ss.uci.edu/data.html#crime'
 citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
[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/crime/__init__.py b/entries/crime/__init__.py
index eb56065..69459de 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -47,7 +47,6 @@ def fetch_upstream(force=False):
 @coerce_props(vforce={"name": "string", "sex": "string"})
 @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] Move more KONECT-derived entries to their original sources by Tiago de Paula Peixoto bf9dc0e
The entries now download the data from where KONECT obtained them (live,
or via the Wayback Machine), using the same release as KONECT where it is
still available, and gain the metadata KONECT dropped; descriptions and
citations are rewritten from the original sources:

- Linton Freeman's UCINET data page: bible_nouns, bison, cattle, hens,
  highschool, kangaroo, macaques, moreno_sheep, physician_trust (the three
  relations and the physicians' attributes), rhesus_monkey,
  train_terrorists, windsurfers (now the networks `interaction` and
  `closeness`), college_freshmen, crime, interactome_yeast (from the
  primary source), moreno_taro (undirected), residence_hall, zebras
- other pages, archived: contiguous_usa, advogato, google, github,
  digg_reply, twitter, bookcrossing, dbtropes_feature (without KONECT's
  spurious "ItemName" tropes)
- movielens_100k (in fact the MovieLens 10M tag assignments)
- dblp release 2017-05-02: dblp_author_paper, dblp_cite, dblp_coauthor
- DBpedia 3.9: dbpedia_country, dbpedia_genre, dbpedia_location,
  dbpedia_occupation, dbpedia_producer, dbpedia_recordlabel,
  dbpedia_starring, dbpedia_team, dbpedia_writer, dbpedia_all, dbpedia_link
- Discogs releases dump of October 2015: discogs_affiliation,
  discogs_genre and discogs_label (now with genre and style networks)
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index bc9e9ce..eb56065 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -19,21 +19,32 @@
 from .. import *
 
 title = "Rosenfeld crime network (1991)"
-description = """A network of associations among suspects, victims, and/or witnesses involved in crimes in St. Louis in the 1990s. Data are derived from police records, via snowball sampling from five initial homicides. Left nodes are people, right nodes are crime events, and edges connect people to particular crimes events they were associated with. Metadata includes names, genders, and roles (suspects, victims, and/or witnesses).[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+description = """Involvement of individuals in crime events in St. Louis (Missouri, USA), collected from police records by R. Rosenfeld and N. White in the 1990s. Starting from five homicides, they recorded the names of all the individuals involved as victims, suspects or witnesses, then searched the files for all the other crimes in which the same individuals appeared, and continued this snowball process until they had data on 557 crime events, with 870 participants: 569 appearances as victims, 682 as suspects, 195 as witnesses, and 41 as both victim and suspect in the same crime. The sex of each individual was also recorded. The data were distributed by L. C. Freeman on his network data page at the University of California, Irvine (no longer online), from which this version was obtained via the Internet Archive.
+
+The network is bipartite: an undirected edge connects an individual to a crime event in which they were involved. One cell of the source matrix is coded as missing ("?"), and is not represented as an edge. The file contains 40 individuals and 4 crime events without any involvement, which are isolated nodes.
+
+The network has the following properties:
+
+- Nodes: `is_crime`, whether the node is a crime event (otherwise, it is an individual); `name`, the name of the individual (with the family name first, without a space), or the identifier of the crime event (two identifiers, 930011 and 930019, are each used for two different crime events); `sex`, the sex of the individual ("F" or "M"; empty for crime events). The coding of sex is not documented in the source (it is given as 0 or 1); it is inferred here from the first names.
+- Edges: `role`, the role of the individual in the crime event ("victim", "suspect", "witness", or "victim and suspect")."""
 tags = ['Social', 'Offline', 'Unweighted', 'Metadata']
-url = 'http://konect.cc/networks/moreno_crime'
+url = 'https://web.archive.org/web/20210115130726/http://moreno.ss.uci.edu/data.html#crime'
 citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
 icon_hash = '57fe7bb68cf714f319c3ac2a'
-upstream_prefix = 'http://konect.cc/files'
-files = [('download.tsv.moreno_crime.tar.bz2', None, 'konect')]
+upstream_license = None
+upstream_prefix = 'https://web.archive.org/web/20210115130726id_/http://moreno.ss.uci.edu'
+files = [(('crime.dat', 'sex.dat'), None, None)]
+
+roles = {1: "victim", 2: "suspect", 3: "witness", 4: "victim and suspect"}
 
 def fetch_upstream(force=False):
-    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
-                                force)
+    # The Wayback Machine refuses connections or fails when rate-limited, so
+    # retry with increasing pauses (files already fetched are skipped)
+    return retry_download(fetch_upstream_files, __name__.split(".")[-1],
+                          upstream_prefix, files, force)
 
 @cache_network()
-@coerce_props()
+@coerce_props(vforce={"name": "string", "sex": "string"})
 @annotate()
 def parse(alts=None):
     global files
@@ -44,6 +55,26 @@ def parse(alts=None):
         if isinstance(fnames, str):
             fnames = [fnames]
         with ExitStack() as stack:
-            fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
-            g = parse_graph(fs, fmt, directed=True)
+            fs = [stack.enter_context(open_upstream_file(name, fn, "rb"))
+                  for fn in fnames]
+            ds = [read_dl(f, pad=False) for f in fs]
+        d, ds_ = ds
+        A = numpy.nan_to_num(d["data"][0]).astype("int")  # "?" -> no edge
+        nr, nc = A.shape
+        g = Graph(directed=False)
+        g.add_vertex(nr + nc)
+        g.vp.is_crime = g.new_vp("bool", vals=[False] * nr + [True] * nc)
+        g.vp.name = g.new_vp("string", vals=d["rows"] + d["cols"])
+        # the rows of the sex file are in a different order, with one
+        # (consistent) duplicate; 1 is male, 0 female (from the first names)
+        sex = {}
+        for l, x in zip(ds_["rows"], ds_["data"][0][:, 0]):
+            assert sex.get(l, x) == x
+            sex[l] = x
+        g.vp.sex = g.new_vp("string", vals=[("M" if sex[l] == 1 else "F")
+                                            for l in d["rows"]] + [""] * nc)
+        g.ep.role = g.new_ep("string")
+        for i, j in zip(*numpy.nonzero(A)):
+            e = g.add_edge(i, nr + j)
+            g.ep.role[e] = roles[A[i, j]]
         yield alt, g
Update copyright information by Tiago de Paula Peixoto 73a4f0d
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index 74b6801..bc9e9ce 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# 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
Update copyright information by Tiago de Paula Peixoto 3d288ea
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index e2370eb..74b6801 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 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
Update copyright information by Tiago de Paula Peixoto 8d005ae
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index 0c161af..e2370eb 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 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
Update copyright info by Tiago de Paula Peixoto db2efcc
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index e02ef96..0c161af 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2021 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
Un-orphan KONECT datasets by Tiago de Paula Peixoto 894eba5
KONECT has been brought back from the dead for the time being.
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index 31c292c..e02ef96 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -26,7 +26,6 @@ url = 'http://konect.cc/networks/moreno_crime'
 citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
 icon_hash = '57fe7bb68cf714f319c3ac2a'
 upstream_prefix = 'http://konect.cc/files'
-orphan = True
 files = [('download.tsv.moreno_crime.tar.bz2', None, 'konect')]
 
 def fetch_upstream(force=False):
Add support for 'orphan' datasets and tag konect entries by Tiago de Paula Peixoto e330b80
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index e02ef96..31c292c 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -26,6 +26,7 @@ url = 'http://konect.cc/networks/moreno_crime'
 citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
 icon_hash = '57fe7bb68cf714f319c3ac2a'
 upstream_prefix = 'http://konect.cc/files'
+orphan = True
 files = [('download.tsv.moreno_crime.tar.bz2', None, 'konect')]
 
 def fetch_upstream(force=False):
Change license from GPLv3 to AGPLv3 by Tiago de Paula Peixoto d754be5
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index d541292..e02ef96 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -3,18 +3,18 @@
 #
 # Copyright (C) 2020 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 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 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 General Public License for more details.
+# 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 General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# 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 *
 
Add explicit attribution to descriptions obtained from ICON by Tiago de Paula Peixoto 1645314
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
index 264b437..d541292 100644
--- a/entries/crime/__init__.py
+++ b/entries/crime/__init__.py
@@ -19,7 +19,8 @@
 from .. import *
 
 title = "Rosenfeld crime network (1991)"
-description = "A network of associations among suspects, victims, and/or witnesses involved in crimes in St. Louis in the 1990s. Data are derived from police records, via snowball sampling from five initial homicides. Left nodes are people, right nodes are crime events, and edges connect people to particular crimes events they were associated with. Metadata includes names, genders, and roles (suspects, victims, and/or witnesses)."
+description = """A network of associations among suspects, victims, and/or witnesses involved in crimes in St. Louis in the 1990s. Data are derived from police records, via snowball sampling from five initial homicides. Left nodes are people, right nodes are crime events, and edges connect people to particular crimes events they were associated with. Metadata includes names, genders, and roles (suspects, victims, and/or witnesses).[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
 tags = ['Social', 'Offline', 'Unweighted', 'Metadata']
 url = 'http://konect.cc/networks/moreno_crime'
 citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
Initial commit by Tiago de Paula Peixoto cc85872
diff --git a/entries/crime/__init__.py b/entries/crime/__init__.py
new file mode 100644
index 0000000..264b437
--- /dev/null
+++ b/entries/crime/__init__.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 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 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+
+title = "Rosenfeld crime network (1991)"
+description = "A network of associations among suspects, victims, and/or witnesses involved in crimes in St. Louis in the 1990s. Data are derived from police records, via snowball sampling from five initial homicides. Left nodes are people, right nodes are crime events, and edges connect people to particular crimes events they were associated with. Metadata includes names, genders, and roles (suspects, victims, and/or witnesses)."
+tags = ['Social', 'Offline', 'Unweighted', 'Metadata']
+url = 'http://konect.cc/networks/moreno_crime'
+citation = [('S. Decker, C. W. Kohfeld, R. Rosenfeld, & J. Sprague, "St. Louis Homicide Project: Local Responses to a National Problem." University of Missouri-St. Louis (1991)', 'https://books.google.com/books/about/The_St_Louis_Homicide_Project.html?id=umVAPQAACAAJ')]
+icon_hash = '57fe7bb68cf714f319c3ac2a'
+upstream_prefix = 'http://konect.cc/files'
+files = [('download.tsv.moreno_crime.tar.bz2', None, 'konect')]
+
+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):
+    global files
+    name = __name__.split(".")[-1]
+    for fnames, alt, fmt in files:
+        if alts is not None and alt not in alts:
+            continue
+        if isinstance(fnames, str):
+            fnames = [fnames]
+        with ExitStack() as stack:
+            fs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
+            g = parse_graph(fs, fmt, directed=True)
+        yield alt, g