History of elec
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] Move KONECT-derived entries to their original sources 45943ea
The entries now download the data from where KONECT obtained them (live or via the Wayback Machine), gaining the metadata KONECT dropped (names, identifiers, timestamps, attributes), with descriptions and citations rewritten from the original sources: - Ma'ayan lab collection: faa_routes, foodweb_little_rock (taxon names were assigned to the wrong nodes), interactome_pdz, interactome_figeys, interactome_stelzl, interactome_vidal - Pajek collection and primary sources: word_assoc (from the Edinburgh Associative Thesaurus; KONECT dropped all counts >= 10), foldoc, new_guinea_tribes - bitriad: elite, ceo_club (adds the CEO KONECT's copy lacked) - Lovro Subelj: cora, euroroad (adds isolated cities and parallel roads) - SNAP: elec (all votes, with elections and nominators) - Zenodo: wiki_talk (user ids and roles) - MPI-SWS: flickr_growth, facebook_wall (edges now point from poster to wall owner, as documented), wikipedia_growth (full timestamps) - Other sources: prosper, jester, reactome (the 2014 release KONECT used), unicodelang (CLDR 27), wordnet (WordNet 3.1), chicago_road (TNTP ChicagoRegional)
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index 0d4ffc0..15aea99 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__init__.py
@@ -19,31 +19,94 @@
from .. import *
title = "Wikipedia adminship vote (2008)"
-description = """A network of votes on Request for Adminship (RfA) elections from a 2008 snapshot of Wikipedia. Nodes represent editors, and a directed edge (i,j) indicates that editor i voted on editor j. Edge sign indicates the direction of the vote: positive = for, and negative = against. Edges are timestamped.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
-tags = ['Social', 'Online', 'Signed', 'Timestamps']
-url = 'http://konect.cc/networks/elec'
-citation = [('J. Leskovec, D. Huttenlocher, and J. Kleinberg. "Governance in social media: A case study of the wikipedia promotion process." Proc. ICWSM (2010).', 'http://www.aaai.org/ocs/index.php/ICWSM/ICWSM10/paper/viewFile/1485/1841/')]
+description = """Votes in the elections of administrators of the English Wikipedia, collected by J. Leskovec, D. Huttenlocher and J. Kleinberg. In order for a Wikipedia user to become an administrator, a Request for Adminship (RfA) is issued, and the community decides on the promotion by a public discussion or a vote. The data were extracted from the complete dump of the Wikipedia page edit history of 3 January 2008, and comprise 2,794 elections held between 2004 and 2008, of which 1,248 resulted in a promotion. Users may be candidates in more than one election.
+
+Nodes are Wikipedia users that cast a vote, were candidates, or nominated a candidate, and a directed edge $(i,j)$ indicates that user $i$ voted in an election of candidate $j$. Each vote is an edge, so the network can contain parallel edges when a user voted in several elections of the same candidate. Some users voted in their own elections (72 self-loops). The 25 users that only appear as nominators have no edges. Some vote times are invalid (in the years 2061 to 2105), and are kept as they are in the source data. The time zone of the times is not documented; they are interpreted as UTC.
+
+The network has the following properties:
+
+- `user_id`: the user ID in the source data.
+- `name`: the user name (lowercased in the source data; in a few names a non-ASCII character is truncated in the source and replaced by U+FFFD).
+- `vote`: the vote, $+1$ (support), $0$ (neutral) or $-1$ (oppose).
+- `time`: the time of the vote, in Unix time.
+- `election`: the number of the election (in the order of the source file, from 0).
+- `promoted`: whether the election resulted in the promotion of the candidate.
+- `closed`: the time the election was closed, in Unix time.
+- `nominator`: the node index of the user that nominated the candidate, or $-1$ if unknown (2,117 elections)."""
+tags = ['Social', 'Online', 'Signed', 'Timestamps', 'Multigraph', 'Metadata']
+url = 'https://snap.stanford.edu/data/wiki-Elec.html'
+citation = [('J. Leskovec, D. Huttenlocher, J. Kleinberg, "Signed networks in social media." Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (CHI \'10), 1361-1370 (2010)', 'https://doi.org/10.1145/1753326.1753532'),
+ ('J. Leskovec, D. Huttenlocher, J. Kleinberg, "Predicting positive and negative links in online social networks." Proceedings of the 19th International Conference on World Wide Web (WWW \'10), 641-650 (2010)', 'https://doi.org/10.1145/1772690.1772756'),
+ ('J. Leskovec, D. Huttenlocher, J. Kleinberg, "Governance in social media: A case study of the Wikipedia promotion process." Proceedings of the International AAAI Conference on Web and Social Media (ICWSM) 4(1), 98-105 (2010)', 'https://doi.org/10.1609/icwsm.v4i1.14013')]
icon_hash = '5818b4f18cf714f319c3ead8'
-upstream_prefix = 'http://konect.cc/files'
-files = [('download.tsv.elec.tar.bz2', None, 'konect')]
+upstream_license = None
+upstream_prefix = 'https://snap.stanford.edu/data'
+files = [('wikiElec.ElecBs3.txt.gz', None, None)]
def fetch_upstream(force=False):
return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
force)
+def _unix_time(s):
+ import datetime
+ t = datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S")
+ return int(t.replace(tzinfo=datetime.timezone.utc).timestamp())
+
@cache_network()
@coerce_props()
@annotate()
def parse(alts=None):
+ import io
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)
+ # One record per election: lines 'E <outcome>', 'T <close time>',
+ # 'U <id> <name>' (candidate), 'N <id> <name>' (nominator, id -1 if
+ # unknown) and one line 'V <vote> <id> <time> <name>' per vote
+ users = {}
+ def user(uid, uname):
+ if uid not in users:
+ users[uid] = (len(users), uname)
+ return users[uid][0]
+ edges = []
+ election = -1
+ with open_upstream_file(name, fnames, "rb") as fb:
+ # a few user names contain truncated UTF-8 sequences
+ f = io.TextIOWrapper(fb, "utf8", errors="replace")
+ for line in f:
+ line = line.rstrip("\r\n")
+ if line == "" or line.startswith("#"):
+ continue
+ r = line.split("\t")
+ if r[0] == "E":
+ election += 1
+ promoted = int(r[1])
+ elif r[0] == "T":
+ closed = _unix_time(r[1])
+ elif r[0] == "U":
+ cand = user(int(r[1]), r[2])
+ elif r[0] == "N":
+ nom = -1 if int(r[1]) == -1 else user(int(r[1]), r[2])
+ elif r[0] == "V":
+ u = user(int(r[2]), r[4])
+ edges.append((u, cand, int(r[1]), _unix_time(r[3]),
+ election, promoted, closed, nom))
+ g = Graph(directed=True)
+ g.add_vertex(len(users))
+ g.vp.user_id = g.new_vp("int")
+ g.vp.name = g.new_vp("string")
+ for uid, (v, uname) in users.items():
+ g.vp.user_id[v] = uid
+ g.vp.name[v] = uname
+ g.ep.vote = g.new_ep("int")
+ g.ep.time = g.new_ep("int64_t")
+ g.ep.election = g.new_ep("int")
+ g.ep.promoted = g.new_ep("bool")
+ g.ep.closed = g.new_ep("int64_t")
+ g.ep.nominator = g.new_ep("int")
+ g.add_edge_list(numpy.array(edges, dtype="int64"),
+ eprops=[g.ep.vote, g.ep.time, g.ep.election,
+ g.ep.promoted, g.ep.closed, g.ep.nominator])
yield alt, g
Update copyright information 73a4f0d
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index 39305f1..0d4ffc0 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__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 3d288ea
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index 0c55258..39305f1 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__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 8d005ae
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index 5c99689..0c55258 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__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 db2efcc
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index e7867f0..5c99689 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__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 894eba5
KONECT has been brought back from the dead for the time being.
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index 8abe331..e7867f0 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__init__.py
@@ -26,7 +26,6 @@ url = 'http://konect.cc/networks/elec'
citation = [('J. Leskovec, D. Huttenlocher, and J. Kleinberg. "Governance in social media: A case study of the wikipedia promotion process." Proc. ICWSM (2010).', 'http://www.aaai.org/ocs/index.php/ICWSM/ICWSM10/paper/viewFile/1485/1841/')]
icon_hash = '5818b4f18cf714f319c3ead8'
upstream_prefix = 'http://konect.cc/files'
-orphan = True
files = [('download.tsv.elec.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Add support for 'orphan' datasets and tag konect entries e330b80
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index e7867f0..8abe331 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__init__.py
@@ -26,6 +26,7 @@ url = 'http://konect.cc/networks/elec'
citation = [('J. Leskovec, D. Huttenlocher, and J. Kleinberg. "Governance in social media: A case study of the wikipedia promotion process." Proc. ICWSM (2010).', 'http://www.aaai.org/ocs/index.php/ICWSM/ICWSM10/paper/viewFile/1485/1841/')]
icon_hash = '5818b4f18cf714f319c3ead8'
upstream_prefix = 'http://konect.cc/files'
+orphan = True
files = [('download.tsv.elec.tar.bz2', None, 'konect')]
def fetch_upstream(force=False):
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index e65c8a1..e7867f0 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__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 1645314
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
index d790e3f..e65c8a1 100644
--- a/entries/elec/__init__.py
+++ b/entries/elec/__init__.py
@@ -19,7 +19,8 @@
from .. import *
title = "Wikipedia adminship vote (2008)"
-description = "A network of votes on Request for Adminship (RfA) elections from a 2008 snapshot of Wikipedia. Nodes represent editors, and a directed edge (i,j) indicates that editor i voted on editor j. Edge sign indicates the direction of the vote: positive = for, and negative = against. Edges are timestamped."
+description = """A network of votes on Request for Adminship (RfA) elections from a 2008 snapshot of Wikipedia. Nodes represent editors, and a directed edge (i,j) indicates that editor i voted on editor j. Edge sign indicates the direction of the vote: positive = for, and negative = against. Edges are timestamped.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Online', 'Signed', 'Timestamps']
url = 'http://konect.cc/networks/elec'
citation = [('J. Leskovec, D. Huttenlocher, and J. Kleinberg. "Governance in social media: A case study of the wikipedia promotion process." Proc. ICWSM (2010).', 'http://www.aaai.org/ocs/index.php/ICWSM/ICWSM10/paper/viewFile/1485/1841/')]
Initial commit cc85872
diff --git a/entries/elec/__init__.py b/entries/elec/__init__.py
new file mode 100644
index 0000000..d790e3f
--- /dev/null
+++ b/entries/elec/__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 = "Wikipedia adminship vote (2008)"
+description = "A network of votes on Request for Adminship (RfA) elections from a 2008 snapshot of Wikipedia. Nodes represent editors, and a directed edge (i,j) indicates that editor i voted on editor j. Edge sign indicates the direction of the vote: positive = for, and negative = against. Edges are timestamped."
+tags = ['Social', 'Online', 'Signed', 'Timestamps']
+url = 'http://konect.cc/networks/elec'
+citation = [('J. Leskovec, D. Huttenlocher, and J. Kleinberg. "Governance in social media: A case study of the wikipedia promotion process." Proc. ICWSM (2010).', 'http://www.aaai.org/ocs/index.php/ICWSM/ICWSM10/paper/viewFile/1485/1841/')]
+icon_hash = '5818b4f18cf714f319c3ead8'
+upstream_prefix = 'http://konect.cc/files'
+files = [('download.tsv.elec.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