History of foursquare_global
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 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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 124875b..6c369c4 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -37,7 +37,7 @@ The two friendship networks have the same node set. The networks have the follow
tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
citation = [('D. Yang, B. Qu, J. Yang, and P. Cudré-Mauroux, "Revisiting User Mobility and Social Relationships in LBSNs: A Hypergraph Embedding Approach." The World Wide Web Conference (WWW \'19), 2147-2157 (2019)', 'https://doi.org/10.1145/3308558.3313635')]
-icon_hash = '595b24a2549f067e0263b552'
+date_added = '2020-08-11'
upstream_license = None
upstream_prefix = 'gdrive://'
files = [(('1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/dataset_WWW_Checkins_anonymized.txt',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) 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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 3fe8223..124875b 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -27,13 +27,13 @@ description = r"""A global data set of check-ins and social ties of users of the
The two friendship networks have the same node set. The networks have the following properties:
-- `name`: the anonymized user ID (an integer, the same in all three networks) or, in `checkins`, the Foursquare venue ID (a hexadecimal string).
-- `is_user` (`checkins` only): whether the node is a user (True) or a venue (False).
-- `latitude` and `longitude` (`checkins` only): coordinates of the venue, in degrees.
-- `venue_cat` (`checkins` only): the Foursquare category of the venue (e.g. "Train Station").
-- `country` (`checkins` only): the ISO 3166-1 alpha-2 code of the country of the venue.
-- `timestamp` (edges, `checkins` only): the time of the check-in (UTC).
-- `timezone_offset` (edges, `checkins` only): the offset in minutes between the local time of the check-in and UTC (UTC time plus the offset gives the local time)."""
+- (Node) `name`: the anonymized user ID (an integer, the same in all three networks) or, in `checkins`, the Foursquare venue ID (a hexadecimal string).
+- (Node) `is_user` (`checkins` only): whether the node is a user (True) or a venue (False).
+- (Node) `latitude` and `longitude` (`checkins` only): coordinates of the venue, in degrees.
+- (Node) `venue_cat` (`checkins` only): the Foursquare category of the venue (e.g. "Train Station").
+- (Node) `country` (`checkins` only): the ISO 3166-1 alpha-2 code of the country of the venue.
+- (Edge) `timestamp` (edges, `checkins` only): the time of the check-in (UTC).
+- (Edge) `timezone_offset` (edges, `checkins` only): the offset in minutes between the local time of the check-in and UTC (UTC time plus the offset gives the local time)."""
tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
citation = [('D. Yang, B. Qu, J. Yang, and P. Cudré-Mauroux, "Revisiting User Mobility and Social Relationships in LBSNs: A Hypergraph Embedding Approach." The World Wide Web Conference (WWW \'19), 2147-2157 (2019)', 'https://doi.org/10.1145/3308558.3313635')]
[entries] Remove unneeded code from the entries 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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 6a36e64..3fe8223 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -64,7 +64,6 @@ def parse_friendships(f):
@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:
[entries] Merge duplicate entries and add cross-references between related ones 9bc6033
- Removed duplicates, merged into the entries holding the same data: dblp_coauthor_snap (soc_net_comms), cattle and bison (dom; bison's breeding data move there, as do the wolves' age and sex), football_tsevans (football, with both conference assignments), eu_procurements_alt (eu_procurements), foursquare_friendships (foursquare_global). - software_dependencies: colt and scolt are one network; ambassador: the duplicate 2001 network is dropped and the three same-edge networks combined; dom: the dataset count corrected (436). - macaque_neural: Young's 71-area network added (young71; the 47-area one is now cocomac47), both from archived copies. - collins_yeast, celegans_interactomes: from archived copies of the dead CCSB site (byte-identical files). - Cross-references between entries holding versions of the same data (food webs, Wikipedia, Slashdot, physicians, SNAP/Mislove, CCSB). - ICON ids of duplicate records added; macaque_neural's corrected. - prosper, dbpedia_all: string properties given in edge-index order (needs graph-tool with the fixed vals ordering).
diff --git a/entries/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 335942a..6a36e64 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -18,18 +18,22 @@
from .. import *
-title = "Foursquare global check-ins (2012-2014)"
-description = r"""A bipartite network of users and venues (points of interest) of the location-based social network Foursquare, where each edge is a check-in of a user at a venue, worldwide, between April 2012 and January 2014. The data were collected by D. Yang and collaborators: since Foursquare check-ins are not publicly accessible, they were obtained from Foursquare-tagged tweets in Twitter's public stream, keeping only active users (with at least one check-in per month) who also appear in the social network snapshots of `foursquare_friendships`. The network contains 22,809,624 check-ins by 114,324 users at 3,820,891 venues; repeated check-ins of a user at the same venue appear as parallel edges.
+title = "Foursquare global check-ins and friendships (2012-2014)"
+description = r"""A global data set of check-ins and social ties of users of the location-based social network Foursquare, collected by D. Yang and collaborators. Since Foursquare check-ins are not publicly accessible, they were obtained from Foursquare-tagged tweets in Twitter's public stream between April 2012 and January 2014, keeping only active users (with at least one check-in per month). Since Foursquare friendships are not publicly available either, the social ties were obtained from Twitter: for each user, their Twitter followers and followees were crawled, and two users are connected if they follow each other. Users without social ties were removed, and only users appearing in both friendship snapshots were kept. The entry contains the following networks:
-The network has the following properties:
+- `checkins`: a bipartite network of users and venues (points of interest), where each edge is a check-in of a user at a venue, worldwide. The network contains 22,809,624 check-ins by 114,324 users at 3,820,891 venues; repeated check-ins of a user at the same venue appear as parallel edges.
+- `friendship_old`: an undirected social network among the users, from a snapshot taken before the check-in collection period (March 2012), with 363,704 friendships.
+- `friendship_new`: the same, from a snapshot taken after the check-in collection period (May 2014), with 607,333 friendships.
-- `is_user`: whether the node is a user (True) or a venue (False).
-- `name`: the anonymized user ID (an integer, matching the user IDs of `foursquare_friendships`) or the Foursquare venue ID (a hexadecimal string).
-- `latitude` and `longitude`: coordinates of the venue, in degrees.
-- `venue_cat`: the Foursquare category of the venue (e.g. "Train Station").
-- `country`: the ISO 3166-1 alpha-2 code of the country of the venue.
-- `timestamp` (edges): the time of the check-in (UTC).
-- `timezone_offset` (edges): the offset in minutes between the local time of the check-in and UTC (UTC time plus the offset gives the local time)."""
+The two friendship networks have the same node set. The networks have the following properties:
+
+- `name`: the anonymized user ID (an integer, the same in all three networks) or, in `checkins`, the Foursquare venue ID (a hexadecimal string).
+- `is_user` (`checkins` only): whether the node is a user (True) or a venue (False).
+- `latitude` and `longitude` (`checkins` only): coordinates of the venue, in degrees.
+- `venue_cat` (`checkins` only): the Foursquare category of the venue (e.g. "Train Station").
+- `country` (`checkins` only): the ISO 3166-1 alpha-2 code of the country of the venue.
+- `timestamp` (edges, `checkins` only): the time of the check-in (UTC).
+- `timezone_offset` (edges, `checkins` only): the offset in minutes between the local time of the check-in and UTC (UTC time plus the offset gives the local time)."""
tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
citation = [('D. Yang, B. Qu, J. Yang, and P. Cudré-Mauroux, "Revisiting User Mobility and Social Relationships in LBSNs: A Hypergraph Embedding Approach." The World Wide Web Conference (WWW \'19), 2147-2157 (2019)', 'https://doi.org/10.1145/3308558.3313635')]
@@ -37,12 +41,25 @@ icon_hash = '595b24a2549f067e0263b552'
upstream_license = None
upstream_prefix = 'gdrive://'
files = [(('1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/dataset_WWW_Checkins_anonymized.txt',
- '1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/raw_POIs.txt'), None, None)]
+ '1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/raw_POIs.txt'), "checkins", None),
+ ('1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/dataset_WWW_friendship_old.txt', "friendship_old", None),
+ ('1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/dataset_WWW_friendship_new.txt', "friendship_new", None)]
def fetch_upstream(force=False):
return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
force)
+def parse_friendships(f):
+ fs = [io.TextIOWrapper(f, encoding="ISO-8859-1")]
+ g = Graph(directed=False)
+ def get_lines():
+ for line in fs[0]:
+ vals = line.split("\t")
+ yield [int(x) for x in vals]
+ g.vp.name = g.add_edge_list(get_lines(), hashed=True,
+ hash_type="int")
+ return g
+
@cache_network()
@coerce_props()
@annotate()
@@ -54,6 +71,11 @@ def parse(alts=None):
continue
if isinstance(fnames, str):
fnames = [fnames]
+ if alt != "checkins":
+ with open_upstream_file(name, fnames[0], "rb") as f:
+ g = parse_friendships(f)
+ yield alt, g
+ continue
with ExitStack() as stack:
bfs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
fs = [io.TextIOWrapper(f, encoding="utf-8") for f in bfs]
[entries] Fix parse bugs and improve the metadata of existing entries c996a0e
From a review of the dataset descriptions against the upstream sources and papers, and from user reports: - parse fixes (wrong edge direction or directedness, shifted or misnamed properties, merged node identities, duplicated or missing edges and nodes, wrong types), e.g. arxiv_citation (the HepTh dates were a copy of the HepPh ones; now from the KDD Cup 2003 data), eu_procurements, foursquare_global, hiv_transmission, genetic_multiplex, gnutella (adds the 05 snapshot), roadnet, macaque_neural, python_dependency - descriptions rewritten from the upstream sources, documenting every property - corrected titles, citations and DOIs, licences (ustream_license typo, the data's own terms), tags and ICON ids - url lists for entries with several sources or dataset pages - SocioPatterns entries moved to the site's new data location, with the daily networks of sp_infectious and sp_primary_school - the Michael Fire entries marked as orphans (served from the mirror) - redundant type forcings removed after the graph-tool coercion fixes
diff --git a/entries/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index aab3774..335942a 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -18,14 +18,23 @@
from .. import *
-title = "Foursquare global check-ins (2013)"
-description = """A bipartite network of users and locations, representing check-in events worldwide on Foursquare, from April 2012 to September 2013. Metadata include country, city name, city type (e.g. national capital), and vender's latitude and longitude.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+title = "Foursquare global check-ins (2012-2014)"
+description = r"""A bipartite network of users and venues (points of interest) of the location-based social network Foursquare, where each edge is a check-in of a user at a venue, worldwide, between April 2012 and January 2014. The data were collected by D. Yang and collaborators: since Foursquare check-ins are not publicly accessible, they were obtained from Foursquare-tagged tweets in Twitter's public stream, keeping only active users (with at least one check-in per month) who also appear in the social network snapshots of `foursquare_friendships`. The network contains 22,809,624 check-ins by 114,324 users at 3,820,891 venues; repeated check-ins of a user at the same venue appear as parallel edges.
+
+The network has the following properties:
+
+- `is_user`: whether the node is a user (True) or a venue (False).
+- `name`: the anonymized user ID (an integer, matching the user IDs of `foursquare_friendships`) or the Foursquare venue ID (a hexadecimal string).
+- `latitude` and `longitude`: coordinates of the venue, in degrees.
+- `venue_cat`: the Foursquare category of the venue (e.g. "Train Station").
+- `country`: the ISO 3166-1 alpha-2 code of the country of the venue.
+- `timestamp` (edges): the time of the check-in (UTC).
+- `timezone_offset` (edges): the offset in minutes between the local time of the check-in and UTC (UTC time plus the offset gives the local time)."""
tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
-citation = [('D. Yang et al., "NationTelescope: Monitoring and visualizing large-scale collective behavior in LBSNs." J. Network and Computer Applications 55, 170-180 (2015)', 'https://doi.org/10.1016/j.jnca.2015.05.010')]
+citation = [('D. Yang, B. Qu, J. Yang, and P. Cudré-Mauroux, "Revisiting User Mobility and Social Relationships in LBSNs: A Hypergraph Embedding Approach." The World Wide Web Conference (WWW \'19), 2147-2157 (2019)', 'https://doi.org/10.1145/3308558.3313635')]
icon_hash = '595b24a2549f067e0263b552'
-ustream_license = None
+upstream_license = None
upstream_prefix = 'gdrive://'
files = [(('1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/dataset_WWW_Checkins_anonymized.txt',
'1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/raw_POIs.txt'), None, None)]
@@ -47,39 +56,41 @@ def parse(alts=None):
fnames = [fnames]
with ExitStack() as stack:
bfs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
- fs = [io.TextIOWrapper(f, encoding="ISO-8859-1") for f in bfs]
+ fs = [io.TextIOWrapper(f, encoding="utf-8") for f in bfs]
g = Graph(directed=False)
- g.vp.is_user = g.new_vp("bool")
+ g.ep.timestamp = g.new_ep("string")
+ g.ep.timezone_offset = g.new_ep("int")
+ # columns: user ID, venue ID, UTC time, timezone offset (minutes)
def get_lines():
for line in fs[0]:
- vals = line.split("\t")
- yield vals
- g.ep.timestap = g.new_ep("string")
- g.ep.timezone_offset = g.new_ep("int")
- eprops = []
+ vals = line.rstrip("\n").split("\t")
+ if len(vals) < 4:
+ continue
+ yield vals[:3] + [int(vals[3])]
g.vp.name = g.add_edge_list(get_lines(), hashed=True,
- hash_type="string", eprops=eprops)
- for v in g.vertices():
- try:
- int(g.vp.name[v])
- except ValueError:
- g.vp.is_user[v] = True
+ hash_type="string",
+ eprops=[g.ep.timestamp,
+ g.ep.timezone_offset])
+ # sources are users, targets are venues
+ g.vp.is_user = g.new_vp("bool")
+ E = g.get_edges()
+ g.vp.is_user.a[E[:, 0]] = True
vs = {g.vp.name[v] : v for v in g.vertices() if not g.vp.is_user[v]}
g.vp.latitude = latitude = g.new_vp("double")
g.vp.longitude = longitude = g.new_vp("double")
g.vp.venue_cat = venue_cat = g.new_vp("string")
g.vp.country = country = g.new_vp("string")
- eprops = [latitude, longitude, venue_cat, country]
+ vprops = [latitude, longitude, venue_cat, country]
for line in fs[1]:
- vals = line.split("\t")
+ vals = line.rstrip("\n").split("\t")
if len(vals) < 2:
continue
try:
v = vs[vals[0]]
except KeyError:
continue
- for p, x in zip(eprops, vals[1:]):
+ for p, x in zip(vprops, vals[1:]):
p[v] = x
yield alt, g
Update copyright information 73a4f0d
diff --git a/entries/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 2f8d353..aab3774 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 6c0bd18..2f8d353 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index d62067a..6c0bd18 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index b841622..d62067a 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__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
Update citations to use DOIs e878874
diff --git a/entries/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index eb5cf2b..b841622 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -23,7 +23,7 @@ description = """A bipartite network of users and locations, representing check
[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
-citation = [('D. Yang et al., "NationTelescope: Monitoring and visualizing large-scale collective behavior in LBSNs." J. Network and Computer Applications 55, 170-180 (2015)', 'http://www.sciencedirect.com/science/article/pii/S1084804515001101')]
+citation = [('D. Yang et al., "NationTelescope: Monitoring and visualizing large-scale collective behavior in LBSNs." J. Network and Computer Applications 55, 170-180 (2015)', 'https://doi.org/10.1016/j.jnca.2015.05.010')]
icon_hash = '595b24a2549f067e0263b552'
ustream_license = None
upstream_prefix = 'gdrive://'
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index 3ee87fa..eb5cf2b 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__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/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
index e463594..3ee87fa 100644
--- a/entries/foursquare_global/__init__.py
+++ b/entries/foursquare_global/__init__.py
@@ -19,7 +19,8 @@
from .. import *
title = "Foursquare global check-ins (2013)"
-description = "A bipartite network of users and locations, representing check-in events worldwide on Foursquare, from April 2012 to September 2013. Metadata include country, city name, city type (e.g. national capital), and vender's latitude and longitude."
+description = """A bipartite network of users and locations, representing check-in events worldwide on Foursquare, from April 2012 to September 2013. Metadata include country, city name, city type (e.g. national capital), and vender's latitude and longitude.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
citation = [('D. Yang et al., "NationTelescope: Monitoring and visualizing large-scale collective behavior in LBSNs." J. Network and Computer Applications 55, 170-180 (2015)', 'http://www.sciencedirect.com/science/article/pii/S1084804515001101')]
Initial commit cc85872
diff --git a/entries/foursquare_global/__init__.py b/entries/foursquare_global/__init__.py
new file mode 100644
index 0000000..e463594
--- /dev/null
+++ b/entries/foursquare_global/__init__.py
@@ -0,0 +1,84 @@
+#! /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 = "Foursquare global check-ins (2013)"
+description = "A bipartite network of users and locations, representing check-in events worldwide on Foursquare, from April 2012 to September 2013. Metadata include country, city name, city type (e.g. national capital), and vender's latitude and longitude."
+tags = ['Social', 'Online', 'Unweighted', 'Metadata', 'Timestamps']
+url = 'https://sites.google.com/site/yangdingqi/home/foursquare-dataset'
+citation = [('D. Yang et al., "NationTelescope: Monitoring and visualizing large-scale collective behavior in LBSNs." J. Network and Computer Applications 55, 170-180 (2015)', 'http://www.sciencedirect.com/science/article/pii/S1084804515001101')]
+icon_hash = '595b24a2549f067e0263b552'
+ustream_license = None
+upstream_prefix = 'gdrive://'
+files = [(('1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/dataset_WWW_Checkins_anonymized.txt',
+ '1PNk3zY8NjLcDiAbzjABzY5FiPAFHq6T8:zip:dataset_WWW2019/raw_POIs.txt'), 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):
+ 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:
+ bfs = [stack.enter_context(open_upstream_file(name, fn, "rb")) for fn in fnames]
+ fs = [io.TextIOWrapper(f, encoding="ISO-8859-1") for f in bfs]
+ g = Graph(directed=False)
+ g.vp.is_user = g.new_vp("bool")
+ def get_lines():
+ for line in fs[0]:
+ vals = line.split("\t")
+ yield vals
+ g.ep.timestap = g.new_ep("string")
+ g.ep.timezone_offset = g.new_ep("int")
+ eprops = []
+ g.vp.name = g.add_edge_list(get_lines(), hashed=True,
+ hash_type="string", eprops=eprops)
+ for v in g.vertices():
+ try:
+ int(g.vp.name[v])
+ except ValueError:
+ g.vp.is_user[v] = True
+
+ vs = {g.vp.name[v] : v for v in g.vertices() if not g.vp.is_user[v]}
+ g.vp.latitude = latitude = g.new_vp("double")
+ g.vp.longitude = longitude = g.new_vp("double")
+ g.vp.venue_cat = venue_cat = g.new_vp("string")
+ g.vp.country = country = g.new_vp("string")
+ eprops = [latitude, longitude, venue_cat, country]
+ for line in fs[1]:
+ vals = line.split("\t")
+ if len(vals) < 2:
+ continue
+ try:
+ v = vs[vals[0]]
+ except KeyError:
+ continue
+ for p, x in zip(eprops, vals[1:]):
+ p[v] = x
+
+ yield alt, g