History of alaska_subsistence
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: alaska_subsistence dae5f33
diff --git a/entries/alaska_subsistence/__init__.py b/entries/alaska_subsistence/__init__.py
new file mode 100644
index 0000000..0a5f9b0
--- /dev/null
+++ b/entries/alaska_subsistence/__init__.py
@@ -0,0 +1,85 @@
+#! /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 *
+
+title = "Subsistence flows in Alaska Native communities (2009-2010)"
+description = """Multiplex, directed and weighted networks of the flows of subsistence-related goods and services among households in three remote Alaska Native communities exposed to climate change and industrial development: Kaktovik (`kaktovik`; the upstream file is named "Kaktovi"), Venetie (`venetie`) and Wainwright (`wainwright`). The data was collected in in-person socio-economic surveys of the heads of household in 2009 and 2010, which covered 70 of the 85 households of Kaktovik, 84 of 89 in Venetie and 146 of 156 in Wainwright.
+
+Nodes are households or crews, and also other sources of resources, such as organizations; they are identified only by anonymous numbers. Each layer corresponds to a pair of a resource (7 to 10 core resources in each community, such as caribou, bowhead whale, beluga, moose, seal, ducks, geese or berries) and a social relation through which it flows (7 to 10 kinds, such as sharing or trading), giving 37 layers in Kaktovik, 43 in Venetie and 36 in Wainwright. A directed edge from one node to another in a layer represents the flow of the resource through the social relation, in the direction given in the source file (from the first to the second node), weighted by the value of the flow; according to the paper, the wild food data was converted to edible pounds, but how the other flows were converted is not stated. The layers are numbered only: the names of the layers (resource-relation pairs) are not included in the upstream data, and the mapping of the numbers to the resource and relation codes of the paper is not available.
+
+The source files also contain interlayer edges, which connect every node to itself in every pair (in both directions) of the layers in which it has edges, all with the same weight in each community (163.8675568 in `kaktovik`, 58.2647048 in `venetie`, 252.8067854 in `wainwright`). They carry no information beyond the layers in which each node is active, and are not included here; their weight is stored as the graph property `interlayer_weight`. A few node pairs are listed twice in the same layer and direction (38 in `kaktovik`, 14 in `venetie`, 29 in `wainwright`), sometimes with different weights; both edges are kept. The nodes are numbered from 1 to 164, 206 and 218, respectively, as in the source; in each community one of these numbers does not appear in any edge, and the corresponding node is isolated.
+
+The networks have the following properties:
+
+- `node_id`: the anonymous number of the node in the source.
+- Edge `layer`: the number of the layer (resource-relation pair), from 1 to the number of layers.
+- Edge `weight`: the value of the flow.
+- Graph `interlayer_weight`: the weight of the interlayer edges of the source, which are not included."""
+tags = ['Social', 'Offline', 'Economic', 'Weighted', 'Multigraph', 'Multilayer']
+url = 'https://github.com/CoMuNeLab/Alaska'
+citation = [('J. A. Baggio, S. B. BurnSilver, A. Arenas, J. S. Magdanz, G. P. Kofinas, M. De Domenico, "Multiplex social ecological network analysis reveals how social changes affect community robustness more than resource depletion." Proceedings of the National Academy of Sciences 113(48), 13708-13713 (2016)', 'https://doi.org/10.1073/pnas.1604401113')]
+icon_hash = None
+upstream_license = ('GNU General Public License v3.0', 'https://github.com/CoMuNeLab/Alaska/blob/master/LICENSE')
+upstream_prefix = 'https://raw.githubusercontent.com/CoMuNeLab/Alaska/6f3803f855c8d7565076e224c33c69a6fd812067'
+files = [('Networks/Kaktovi.edges', 'kaktovik', None),
+ ('Networks/Venetie.edges', 'venetie', None),
+ ('Networks/Wainwright.edges', 'wainwright', None)]
+
+# number of nodes of each community, according to the README
+_N = {'kaktovik': 164, 'venetie': 206, 'wainwright': 218}
+
+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 fname, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ edges = []
+ inter_w = set()
+ with open_upstream_file(name, fname, "r") as f:
+ # nodeFrom layerFrom nodeTo layerTo weight
+ for line in f:
+ row = line.split()
+ if len(row) == 0:
+ continue
+ u, lu, v, lv, w = row
+ if lu != lv:
+ # interlayer coupling of a node with itself
+ assert u == v
+ inter_w.add(float(w))
+ continue
+ edges.append((int(u) - 1, int(v) - 1, int(lu), float(w)))
+ assert len(inter_w) == 1
+ N = max(_N[alt], max(max(e[0], e[1]) for e in edges) + 1)
+ g = Graph(directed=True)
+ g.add_vertex(N)
+ g.vp.node_id = g.new_vp("int", vals=range(1, N + 1))
+ g.ep.layer = g.new_ep("int")
+ g.ep.weight = g.new_ep("double")
+ g.add_edge_list(edges, eprops=[g.ep.layer, g.ep.weight])
+ g.gp.interlayer_weight = g.new_gp("double", val=inter_w.pop())
+ yield alt, g