logo Netzschleuder network catalog, repository, and centrifuge

History of asu_social_networks

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] New entry: asu_social_networks by Tiago de Paula Peixoto 2ac82a3
diff --git a/entries/asu_social_networks/__init__.py b/entries/asu_social_networks/__init__.py
new file mode 100644
index 0000000..e3ba455
--- /dev/null
+++ b/entries/asu_social_networks/__init__.py
@@ -0,0 +1,88 @@
+#! /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 pandas
+
+title = "Online social networks, ASU crawls (2010)"
+description = """Friendship networks of several online social websites, crawled in 2010 by students of H. Liu's group at Arizona State University and distributed by the Social Computing Data Repository (originally at Arizona State University, now at Syracuse University). Nodes are users (anonymized), and a directed edge $i \\to j$ indicates that user $j$ is listed as a friend of user $i$ (the source data state that "user $i$ is friend with user $j$"; the meaning of the direction depends on the site, e.g. on Twitter a "friend" is presumably an account followed by the user). The crawls collected the friend lists of a set of users (marked by the property `crawled`); their friends that were not crawled are also included as nodes.
+
+| Network | Website | Crawled | Crawled users | Nodes | Edges |
+|---|---|---|---|---|---|
+| `digg` | Digg (social news) | December 2010 (M. Nagendra) | 116,893 | 771,231 | 7,261,524 |
+| `foursquare` | Foursquare (location-based social network) | December 2010 (F. Morstatter) | 106,218 | 639,014 | 3,473,834 |
+| `friendster` | Friendster (social networking) | November 2010 (S. Booher) | 100,199 | 5,689,498 | 14,067,887 |
+| `lastfm` | Last.fm (music) | December 2010 (M. Kearl) | 108,493 | 1,193,699 | 5,115,300 |
+| `buzznet` | Buzznet (photo, journal and video sharing) | November 2010 | 101,168 | 101,168 | 4,284,534 |
+| `delicious` | Delicious (social bookmarking) | December 2010 (A. Anand) | 103,144 | 537,387 | 1,385,843 |
+| `twitter` | Twitter (microblogging) | (not documented) | 11,316,811 | 11,316,811 | 85,331,845 |
+
+For `twitter`, all users are marked as crawled, and the file contains one edge less than the 85,331,846 stated in the source documentation. Some edges are self-loops; in `buzznet`, 166,989 friend listings are repeated, and are kept as parallel edges. The source documentation of `delicious` states 1,419,519 edges, more than are contained in the file. The Douban, Flixster, Hyves and Livemocha networks of the same repository are in the separate entries `douban`, `flixster`, `hyves` and `livemocha` (obtained from KONECT), and the LiveJournal network is in `livejournal_asu`.
+
+The networks have the following properties:
+
+- `user_id`: the identifier of the user in the source data.
+- `crawled`: whether the friend list of the user was crawled (i.e. the user is listed in the node file of the source data)."""
+tags = ['Social', 'Online', 'Unweighted', 'Multigraph', 'Metadata']
+url = 'https://datasets.syr.edu/'
+citation = [('R. Zafarani, H. Liu, "Social Computing Data Repository at ASU." Arizona State University, School of Computing, Informatics and Decision Systems Engineering (2009)', 'https://datasets.syr.edu/')]
+icon_hash = '592de96067ec90f1500d4e46'
+upstream_license = None
+# The repository moved from Arizona State University to Syracuse University
+upstream_prefix = 'https://datasets.syr.edu/uploads'
+nets = {'digg': ('1296588940', 'Digg'),
+        'foursquare': ('1296674602', 'Foursquare'),
+        'friendster': ('1296774131', 'Friendster'),
+        'lastfm': ('1296591553', 'Last.fm'),
+        'buzznet': ('1296599993', 'BuzzNet'),
+        'delicious': ('1296675076', 'Delicious'),
+        'twitter': ('1296759055', 'Twitter')}
+files = [((f'{d}/{n}-dataset.zip:{n}-dataset/data/edges.csv',
+           f'{d}/{n}-dataset.zip:{n}-dataset/data/nodes.csv'), alt, None)
+         for alt, (d, n) in nets.items()]
+
+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
+        # One edge "i,j" per line; users are numbered from 1
+        with open_upstream_file(name, fnames[0], "rb") as f:
+            E = pandas.read_csv(f, header=None, dtype="int64").values
+        with open_upstream_file(name, fnames[1], "rb") as f:
+            nodes = pandas.read_csv(f, header=None, dtype="int64").values.ravel()
+        # Keep only the users that occur in some edge or in the node list,
+        # numbered in increasing order of their identifiers
+        ids, E = numpy.unique(numpy.concatenate((E.ravel(), nodes)),
+                              return_inverse=True)
+        E = E[:-len(nodes)].reshape(-1, 2)
+        g = Graph(directed=True)
+        g.add_vertex(len(ids))
+        g.add_edge_list(E)
+        g.vp.user_id = g.new_vp("int64_t", vals=ids)
+        g.vp.crawled = g.new_vp("bool")
+        g.vp.crawled.a[numpy.searchsorted(ids, nodes)] = 1
+        yield alt, g