History of sp_high_school
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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index c119c43..c6194f7 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -40,7 +40,7 @@ The networks have the following properties:
tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
url = 'https://sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
citation = [('R. Mastrandrea, et al., "Contact Patterns in a High School: A Comparison between Data Collected Using Wearable Sensors, Contact Diaries and Friendship Surveys." PLoS ONE 10(9), e0136497 (2015)', 'https://doi.org/10.1371/journal.pone.0136497')]
-icon_hash = '594b401d4ed8f1bb6022ae40'
+date_added = '2020-08-11'
upstream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
"http://creativecommons.org/licenses/by-nc-sa/3.0/")
upstream_prefix = 'https://sociopatterns.org/assets/data'
[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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index f046e43..c119c43 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -32,11 +32,11 @@ All networks include the 329 students in the metadata file, including those with
The networks have the following properties:
-- `id`: the anonymous identifier of the student.
-- `class`: the class of the student (e.g. `MP*1`, `PC`, `2BIO3`).
-- `gender`: the gender of the student (`M`, `F` or `Unknown`).
-- `time` (`proximity`): the end of the 20-second interval $[t - 20\,\text{s}, t]$ during which the contact was active, as a UNIX timestamp in seconds.
-- `weight` (`diaries`): the reported cumulative duration of the contacts, 1 for at most 5 minutes, 2 for 5 to 15 minutes, 3 for 15 minutes to 1 hour, and 4 for more than 1 hour."""
+- (Node) `id`: the anonymous identifier of the student.
+- (Node) `class`: the class of the student (e.g. `MP*1`, `PC`, `2BIO3`).
+- (Node) `gender`: the gender of the student (`M`, `F` or `Unknown`).
+- (Edge) `time` (`proximity`): the end of the 20-second interval $[t - 20\,\text{s}, t]$ during which the contact was active, as a UNIX timestamp in seconds.
+- (Edge) `weight` (`diaries`): the reported cumulative duration of the contacts, 1 for at most 5 minutes, 2 for 5 to 15 minutes, 3 for 15 minutes to 1 hour, and 4 for more than 1 hour."""
tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
url = 'https://sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
citation = [('R. Mastrandrea, et al., "Contact Patterns in a High School: A Comparison between Data Collected Using Wearable Sensors, Contact Diaries and Friendship Surveys." PLoS ONE 10(9), e0136497 (2015)', 'https://doi.org/10.1371/journal.pone.0136497')]
[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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 9eae289..f046e43 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -57,7 +57,6 @@ def fetch_upstream(force=False):
@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] 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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 8be6861..9eae289 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -21,31 +21,33 @@ from .. import *
import csv
title = "High school temporal contacts (2013)"
-description = """These data sets correspond to the contacts and friendship relations between students in a high school in Marseilles, France, in December 2013, as measured through several techniques.[^icon]
+description = r"""Networks of contacts and friendships among the students of nine classes of a high school (the "classes préparatoires" Lycée Thiers) in Marseilles, France, collected by the SocioPatterns collaboration in December 2013. Nodes are students. The data were collected through four techniques, each giving a separate network:
-The first data set gives the contacts of the students of nine classes during 5 days in Dec. 2013, as measured by the SocioPatterns infrastructure. The file contains a tab-separated list representing the active contacts during 20-second intervals of the data collection. Each line has the form “t i j Ci Cj“, where i and j are the anonymous IDs of the persons in contact, Ci and Cj are their classes, and the interval during which this contact was active is [ t – 20s, t ]. If multiple contacts are active in a given interval, you will see multiple lines starting with the same value of t. Time is measured in seconds and expressed in UNIX ctime.
+- `proximity`: face-to-face proximity contacts measured by wearable sensors over 5 days (2 to 6 December 2013). Each edge is a contact between two students active during a 20-second interval of the data collection, so that a pair of students is connected by one edge per interval in which they were in contact.
+- `diaries`: directed network of contacts reported by the students in contact diaries filled at the end of the fourth day of the data collection. An edge $i \to j$ means that student $i$ reported a contact with student $j$; the weight encodes the reported cumulative duration of contact during the day.
+- `survey`: directed network of friendships reported in a survey, where an edge $i \to j$ means that student $i$ reported a friendship with student $j$.
+- `facebook`: undirected network of Facebook friendships, among the pairs of students for which the presence or absence of the Facebook friendship is known. Only the pairs that are linked on Facebook are included as edges, so that the absence of an edge does not imply that the friendship is known to be absent.
-The second data set corresponds to the directed network of contacts between students as reported in contact diaries collected at the end of the fourth day of the data collection. Each line has the form “i j w”, meaning that student i reported contacts with student j of aggregate durations of (i) at most 5 min if w = 1, (ii) between 5 and 15 min if w = 2, (iii) between 15 min and 1 h if w = 3, (iv) more than 1 h if w = 4.
+All networks include the 329 students in the metadata file, including those without any edges in a given network.
-The third data set corresponds to the directed network of reported friendships. Each line has the form “i j”, meaning that student i reported a friendship with student j.
+The networks have the following properties:
-The fourth data set corresponds to the list of pairs of students for which the presence or absence of a Facebook friendship is known. Each line has the form “i j w”, where w=1 means that students i and j are linked on Facebook, while w=0 means that they are not.
-
-Finally the metadata file contains a tab-separated list in which each line of the form “i Ci Gi” gives class Ci and gender Gi of the person having ID i.
-
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project.
-"""
+- `id`: the anonymous identifier of the student.
+- `class`: the class of the student (e.g. `MP*1`, `PC`, `2BIO3`).
+- `gender`: the gender of the student (`M`, `F` or `Unknown`).
+- `time` (`proximity`): the end of the 20-second interval $[t - 20\,\text{s}, t]$ during which the contact was active, as a UNIX timestamp in seconds.
+- `weight` (`diaries`): the reported cumulative duration of the contacts, 1 for at most 5 minutes, 2 for 5 to 15 minutes, 3 for 15 minutes to 1 hour, and 4 for more than 1 hour."""
tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
-url = 'http://www.sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
+url = 'https://sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
citation = [('R. Mastrandrea, et al., "Contact Patterns in a High School: A Comparison between Data Collected Using Wearable Sensors, Contact Diaries and Friendship Surveys." PLoS ONE 10(9), e0136497 (2015)', 'https://doi.org/10.1371/journal.pone.0136497')]
icon_hash = '594b401d4ed8f1bb6022ae40'
-ustream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
+upstream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
"http://creativecommons.org/licenses/by-nc-sa/3.0/")
-upstream_prefix = 'http://www.sociopatterns.org/wp-content/uploads'
-files = [(('2015/07/High-School_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'proximity', None),
- (('2015/07/Contact-diaries-network_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'diaries', None),
- (('2015/07/Friendship-network_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'survey', None),
- (('2015/07/Facebook-known-pairs_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'facebook', None)]
+upstream_prefix = 'https://sociopatterns.org/assets/data'
+files = [(('HighSchool2013_proximity_net.csv.gz', 'HighSchool2013_metadata.txt'), 'proximity', None),
+ (('HighSchool2013_contactdiaries_network.csv.gz', 'HighSchool2013_metadata.txt'), 'diaries', None),
+ (('HighSchool2013_friendship_network.csv.gz', 'HighSchool2013_metadata.txt'), 'survey', None),
+ (('HighSchool2013_facebook_known_pairs.csv.gz', 'HighSchool2013_metadata.txt'), 'facebook', None)]
def fetch_upstream(force=False):
return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
Update copyright information 73a4f0d
diff --git a/entries/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index ee28984..8be6861 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 73ca020..ee28984 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 04a611e..73ca020 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__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
sp_high_school, sp_high_school_new, sp_primary_school: fix node ids f5db9a9
diff --git a/entries/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 5213c0c..04a611e 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -108,6 +108,7 @@ def parse(alts=None):
v = int(row[0])
if v not in vs:
vs[v] = g.add_vertex()
+ g.vp.id[vs[v]] = v
v = vs[v]
g.vp["class"][v] = row[1]
g.vp["gender"][v] = row[2]
sp_high_school: fix metadata parsing 3e8a532
diff --git a/entries/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index f8a83ab..5213c0c 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -110,7 +110,7 @@ def parse(alts=None):
vs[v] = g.add_vertex()
v = vs[v]
g.vp["class"][v] = row[1]
- g.vp["class"][v] = row[2]
+ g.vp["gender"][v] = row[2]
g = Graph(g, vorder=g.vp.id)
yield alt, g
Update copyright info db2efcc
diff --git a/entries/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 8e0ec6f..f8a83ab 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index 25e6a46..8e0ec6f 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -37,7 +37,7 @@ Finally the metadata file contains a tab-separated list in which each line of th
"""
tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
url = 'http://www.sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
-citation = [('R. Mastrandrea, et al., "Contact Patterns in a High School: A Comparison between Data Collected Using Wearable Sensors, Contact Diaries and Friendship Surveys." PLoS ONE 10(9), e0136497 (2015)', 'http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0136497')]
+citation = [('R. Mastrandrea, et al., "Contact Patterns in a High School: A Comparison between Data Collected Using Wearable Sensors, Contact Diaries and Friendship Surveys." PLoS ONE 10(9), e0136497 (2015)', 'https://doi.org/10.1371/journal.pone.0136497')]
icon_hash = '594b401d4ed8f1bb6022ae40'
ustream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
"http://creativecommons.org/licenses/by-nc-sa/3.0/")
Change license from GPLv3 to AGPLv3 d754be5
diff --git a/entries/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index aa05f75..25e6a46 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__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/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
index a9662c7..aa05f75 100644
--- a/entries/sp_high_school/__init__.py
+++ b/entries/sp_high_school/__init__.py
@@ -21,7 +21,7 @@ from .. import *
import csv
title = "High school temporal contacts (2013)"
-description = """These data sets correspond to the contacts and friendship relations between students in a high school in Marseilles, France, in December 2013, as measured through several techniques.
+description = """These data sets correspond to the contacts and friendship relations between students in a high school in Marseilles, France, in December 2013, as measured through several techniques.[^icon]
The first data set gives the contacts of the students of nine classes during 5 days in Dec. 2013, as measured by the SocioPatterns infrastructure. The file contains a tab-separated list representing the active contacts during 20-second intervals of the data collection. Each line has the form “t i j Ci Cj“, where i and j are the anonymous IDs of the persons in contact, Ci and Cj are their classes, and the interval during which this contact was active is [ t – 20s, t ]. If multiple contacts are active in a given interval, you will see multiple lines starting with the same value of t. Time is measured in seconds and expressed in UNIX ctime.
@@ -33,6 +33,7 @@ The fourth data set corresponds to the list of pairs of students for which the p
Finally the metadata file contains a tab-separated list in which each line of the form “i Ci Gi” gives class Ci and gender Gi of the person having ID i.
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project.
"""
tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
url = 'http://www.sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
Initial commit cc85872
diff --git a/entries/sp_high_school/__init__.py b/entries/sp_high_school/__init__.py
new file mode 100644
index 0000000..a9662c7
--- /dev/null
+++ b/entries/sp_high_school/__init__.py
@@ -0,0 +1,115 @@
+#! /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 *
+
+import csv
+
+title = "High school temporal contacts (2013)"
+description = """These data sets correspond to the contacts and friendship relations between students in a high school in Marseilles, France, in December 2013, as measured through several techniques.
+
+The first data set gives the contacts of the students of nine classes during 5 days in Dec. 2013, as measured by the SocioPatterns infrastructure. The file contains a tab-separated list representing the active contacts during 20-second intervals of the data collection. Each line has the form “t i j Ci Cj“, where i and j are the anonymous IDs of the persons in contact, Ci and Cj are their classes, and the interval during which this contact was active is [ t – 20s, t ]. If multiple contacts are active in a given interval, you will see multiple lines starting with the same value of t. Time is measured in seconds and expressed in UNIX ctime.
+
+The second data set corresponds to the directed network of contacts between students as reported in contact diaries collected at the end of the fourth day of the data collection. Each line has the form “i j w”, meaning that student i reported contacts with student j of aggregate durations of (i) at most 5 min if w = 1, (ii) between 5 and 15 min if w = 2, (iii) between 15 min and 1 h if w = 3, (iv) more than 1 h if w = 4.
+
+The third data set corresponds to the directed network of reported friendships. Each line has the form “i j”, meaning that student i reported a friendship with student j.
+
+The fourth data set corresponds to the list of pairs of students for which the presence or absence of a Facebook friendship is known. Each line has the form “i j w”, where w=1 means that students i and j are linked on Facebook, while w=0 means that they are not.
+
+Finally the metadata file contains a tab-separated list in which each line of the form “i Ci Gi” gives class Ci and gender Gi of the person having ID i.
+
+"""
+tags = ['Social', 'Offline', 'Unweighted', 'Weighted', 'Temporal', 'Metadata']
+url = 'http://www.sociopatterns.org/datasets/high-school-contact-and-friendship-networks/'
+citation = [('R. Mastrandrea, et al., "Contact Patterns in a High School: A Comparison between Data Collected Using Wearable Sensors, Contact Diaries and Friendship Surveys." PLoS ONE 10(9), e0136497 (2015)', 'http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0136497')]
+icon_hash = '594b401d4ed8f1bb6022ae40'
+ustream_license = ("Creative Commons Attribution-NonCommercial-ShareAlike",
+ "http://creativecommons.org/licenses/by-nc-sa/3.0/")
+upstream_prefix = 'http://www.sociopatterns.org/wp-content/uploads'
+files = [(('2015/07/High-School_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'proximity', None),
+ (('2015/07/Contact-diaries-network_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'diaries', None),
+ (('2015/07/Friendship-network_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'survey', None),
+ (('2015/07/Facebook-known-pairs_data_2013.csv.gz', '2015/09/metadata_2013.txt'), 'facebook', 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:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+ reader = csv.reader(fs[0], delimiter=" ")
+
+ if alt == "proximity":
+ def get_edges():
+ for rows in reader:
+ t, u, v = [int(x) for x in rows[:3]]
+ yield u, v, t
+ g = Graph(directed=False)
+ g.ep.time = g.new_ep("int")
+ g.vp.id = g.add_edge_list(get_edges(), hashed=True,
+ hash_type="int", eprops=[g.ep.time])
+ elif alt == "diaries":
+ def get_edges():
+ for rows in reader:
+ yield [int(x) for x in rows]
+ g = Graph(directed=True)
+ g.ep.weight = g.new_ep("int")
+ g.vp.id = g.add_edge_list(get_edges(), hashed=True,
+ hash_type="int", eprops=[g.ep.weight])
+ elif alt == "survey":
+ def get_edges():
+ for rows in reader:
+ yield [int(x) for x in rows]
+ g = Graph(directed=True)
+ g.vp.id = g.add_edge_list(get_edges(), hashed=True,
+ hash_type="int")
+ elif alt == "facebook":
+ def get_edges():
+ for rows in reader:
+ if int(rows[2]) == 0:
+ continue
+ yield [int(x) for x in rows[:2]]
+ g = Graph(directed=False)
+ g.vp.id = g.add_edge_list(get_edges(), hashed=True,
+ hash_type="int")
+ vs = {g.vp.id[v] : v for v in g.vertices()}
+
+ g.vp["class"] = g.new_vp("string")
+ g.vp["gender"] = g.new_vp("string")
+ reader = csv.reader(fs[1], delimiter="\t")
+ for row in reader:
+ v = int(row[0])
+ if v not in vs:
+ vs[v] = g.add_vertex()
+ v = vs[v]
+ g.vp["class"][v] = row[1]
+ g.vp["class"][v] = row[2]
+
+ g = Graph(g, vorder=g.vp.id)
+ yield alt, g