[GRASS-SVN] r73317 - in grass-addons/grass7/raster: . r.connectivity r.connectivity/r.connectivity.corridors r.connectivity/r.connectivity.distance r.connectivity/r.connectivity.network

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 12 05:01:09 PDT 2018


Author: sbl
Date: 2018-09-12 05:01:08 -0700 (Wed, 12 Sep 2018)
New Revision: 73317

Added:
   grass-addons/grass7/raster/r.connectivity/
   grass-addons/grass7/raster/r.connectivity/Makefile
   grass-addons/grass7/raster/r.connectivity/conectivity_images.sh
   grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/
   grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/Makefile
   grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.html
   grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.py
   grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_cf_u_sum_all.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_mst_eb.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/Makefile
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.html
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.py
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_costs.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_network.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_patches.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_shortest_paths.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.html
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/Makefile
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/kernel.eps
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.eps
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.html
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.py
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_deg_udc.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_ebc_udc.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_kernel.png
   grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_overview.png
Log:
first step in porting r.connectivity to G7/Python

Added: grass-addons/grass7/raster/r.connectivity/Makefile
===================================================================
--- grass-addons/grass7/raster/r.connectivity/Makefile	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/Makefile	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,16 @@
+MODULE_TOPDIR = ../..
+
+PGM=r.connectivity
+
+SUBDIRS = r.connectivity.distance  \
+	r.connectivity.network  \
+	r.connectivity.corridors    
+
+###  libconnectivity \
+	
+include $(MODULE_TOPDIR)/include/Make/Dir.make
+
+default: parsubdirs htmldir
+
+install: installsubdirs
+	$(INSTALL_DATA) $(PGM).html $(INST_DIR)/docs/html/


Property changes on: grass-addons/grass7/raster/r.connectivity/Makefile
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-makefile
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/conectivity_images.sh
===================================================================
--- grass-addons/grass7/raster/r.connectivity/conectivity_images.sh	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/conectivity_images.sh	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,132 @@
+#########################################
+# r.connectivity.distance
+#########################################
+
+#########################################
+# Costs
+#########################################
+
+# Generate image
+#d.mon wx0
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_distance_costs.png
+d.rast costs
+d.mon stop=cairo
+# save image to files (manually)
+# crop the background using Gimp or ImageMagic
+mogrify -trim r_connectivity_distance_costs.png
+# some bounding box problems noticed when opening mogrify result in Gimp
+
+# Optimize for SVN
+../../../../tools/svn-image.sh r_connectivity_distance_costs.png
+
+#########################################
+# Patches
+#########################################
+
+# Generate image
+#d.mon wx0
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_distance_patches.png
+#d.rast costs
+d.vect patches_1ha
+d.mon stop=cairo
+# save image to files (manually)
+# crop the background using Gimp or ImageMagic
+mogrify -trim r_connectivity_distance_patches.png
+# some bounding box problems noticed when opening mogrify result in Gimp
+
+# Optimize for SVN
+../../../../tools/svn-image.sh r_connectivity_distance_patches.png
+
+#########################################
+# Shortest paths
+#########################################
+
+# Generate image
+#d.mon wx0
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_distance_shortest_paths.png
+d.vect patches_1ha
+d.vect hws_connectivity_shortest_paths
+d.mon stop=cairo
+# save image to files (manually)
+# crop the background using Gimp or ImageMagic
+mogrify -trim r_connectivity_distance_shortest_paths.png
+# some bounding box problems noticed when opening mogrify result in Gimp
+
+# Optimize for SVN
+../../../tools/svn-image.sh r_connectivity_distance_shortest_paths.png
+
+#########################################
+# Network
+#########################################
+
+# Generate image
+#d.mon wx0
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_distance_network.png
+d.vect hws_connectivity_vertices
+d.vect hws_connectivity_edges
+d.mon stop=cairo
+# save image to files (manually)
+# crop the background using Gimp or ImageMagic
+mogrify -trim r_connectivity_distance_network.png
+# some bounding box problems noticed when opening mogrify result in Gimp
+
+# Optimize for SVN
+../../../../tools/svn-image.sh r_connectivity_distance_network.png
+
+#########################################
+# r.connectivity.network
+#########################################
+
+# Convert output from r.connectivity.network plots
+convert -density 171 overview.eps -flatten r_connectivity_network_overview.png
+../../../../tools/svn-image.sh r_connectivity_network_overview.png
+convert -density 171 kernel.eps -flatten r_connectivity_network_kernel.png
+../../../../tools/svn-image.sh r_connectivity_network_kernel.png
+
+# degree centrality
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_network_deg_udc.png
+d.vect map=hws_connectivity_edge_measures legend_label=Edges
+d.vect.thematic map=hws_connectivity_vertex_measures column=deg_udc algorithm=qua nclasses=4 colors=red,orange,yellow,green icon=basic/circle size=8 legend_title="Degree centrality"
+d.legend.vect at=0,100
+d.mon stop=cairo
+#convert -density 73 r_connectivity_network_deg_udc.svg -flatten r_connectivity_network_deg_udc.png
+../../../../tools/svn-image.sh r_connectivity_network_deg_udc.png
+
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_network_ebc_udc.png
+d.vect -r map=hws_connectivity_vertex_measures icon=basic/circle size_column=pop_proxy legend_label=Vertices
+d.vect.thematic map=hws_connectivity_edge_measures column=cf_eb_udc algorithm=qua nclasses=4 colors=191:191:191,184:218:184,92:176:92,0:128:0 where="cf_mst_udc = 1" legend_title="Edge betweenness"
+d.legend.vect at=0,100
+d.mon stop=cairo
+#convert -density 73 r_connectivity_network_ebc_udc.svg -flatten r_connectivity_network_ebc_udc.png
+../../../../tools/svn-image.sh r_connectivity_network_ebc_udc.png
+
+#########################################
+# r.connectivity.corridors
+#########################################
+
+### mst corridors weighted by edge betweenness
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_corridors_mst_eb.png
+d.rast map=hws_connectivity_corridors_cd_eb_ud_sum_mst
+d.legend raster=hws_connectivity_corridors_cd_eb_ud_sum_mst at stefan.blumentrath title="Edge betweenness"
+d.mon stop=cairo
+# save image to files (manually)
+# crop the background using Gimp or ImageMagic
+mogrify -trim r_connectivity_corridors_mst_eb.png
+# some bounding box problems noticed when opening mogrify result in Gimp
+
+# Optimize for SVN
+../../../../tools/svn-image.sh r_connectivity_corridors_mst_eb.png
+
+### all corridors weighted by potential flow of organisms
+d.mon start=cairo width=600  height=600 bgcolor=none output=r_connectivity_corridors_cf_u_sum_all.png
+d.rast map=hws_connectivity_corridors_cf_u_sum_all
+d.legend raster=hws_connectivity_corridors_cf_u_sum_all title="Potential flow"
+d.mon stop=cairo
+# save image to files (manually)
+# crop the background using Gimp or ImageMagic
+mogrify -trim r_connectivity_corridors_cf_u_sum_all.png
+# some bounding box problems noticed when opening mogrify result in Gimp
+
+# Optimize for SVN
+../../../../tools/svn-image.sh r_connectivity_corridors_cf_u_sum_all.png
+


Property changes on: grass-addons/grass7/raster/r.connectivity/conectivity_images.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/x-sh
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/Makefile
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/Makefile	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/Makefile	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.connectivity.corridors
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/Makefile
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-makefile
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.html
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.html	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,126 @@
+<h2>DESCRIPTION</h2>
+
+r.connectivity.corridors is th 3rd tool of the r.connectivity.* toolset.
+
+<p>
+<em>r.connectivity.corridors</em> loops through the user-selected edges 
+(<b>where</b> option) of the edge-measure output vector map from 
+<em>r.connectivity.network</em> and computes the respective corridor(s).
+</p>
+<p>
+Corridors are defined as all pixels that have a lower average cost distance 
+from a pair of patches, than the average cost distance between that pair. 
+The user can add a tolerance for allowed deviation from cost distance 
+within corridors in %, using the <b>corridor_tolerance</b> option.
+</p>
+<p>
+<em>r.connectivity.corridors</em> can account for the importance of the 
+corridors for the entire network by weighting them with regards to one or 
+more network measures from <em>r.connectivity.network</em>, using the 
+<b>weights</b> option.
+</p>
+Thus, <em>r.connectivity.corridors</em> produces two types of output,
+that are named according to a user defined <b>prefix</b> and <b>suffix</b>:
+<ol>
+<li>a set of individual corridor raster maps 
+(named: <b>prefix</b>_corridor_<b>edge_id</b>_<b>weight</b>) and</li>
+<li>a summary over all computed corridors 
+(named: <b>prefix</b>_corridor_<b>edge_id</b>_<b>weight</b>_sum_<b>suffix</b>).
+</li>
+</ol>
+
+<p>
+Finally, all individual corridors are being put together using <em>r.series</em>. 
+In this step, the values of the cells in all corridor maps are summed up, 
+which indicates the importance of an area (raster cell) for the network 
+of the given patches (either the number of corridors a cell is part of, 
+or other graph-theoretical measures for corridor importance).
+</p>
+
+<h2>NOTES</h2>
+Corridors are only computed for an undirected graph.
+
+<h2>EXAMPLE</h2>
+The following example is continued from and based on the example in 
+<em>r.connectivity.network</em>!
+
+<p>In this example two alternative (or to some extent complementary) sets 
+of corridors are calculated:</p>
+
+<h3>Corridor set 1:</h3>
+For the first set, corridors are only computed for the minimum spanning 
+tree (in literture sometimes called the backbone of an ecological network). 
+This is specified in the "where"-parameter. Edge betweenness values are 
+used as weights, which represent the centrality of a connection (edge) 
+in a network (and is therewith a measure of importance). The output is a 
+set of corridor raster maps (named: "prefix" _corridor_ "edge_id" _ "weight") 
+and a summary over all computed corridors 
+(named: "prefix" _corridor_ "edge_id" _ "weight" _sum_ "suffix").
+
+<div class="code"><pre>
+r.connectivity.corridors input=hws_connectivity_edge_measures layer=1 \
+weights=cd_eb_ud suffix=mst corridor_tolerance=0.05 where="cf_mst_ud>0" \
+cores=1
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_corridors_mst_eb.png">
+<img src="r_connectivity_corridors_mst_eb.png" width="600" height="600" 
+alt="Corridors computed for connections on the minimum spanning tree 
+weighted by edge betweenness in the example above." border="0">
+</a><br>
+<i>Figure: Corridors computed for connections on the minimum spanning 
+tree weighted by edge betweenness in the example above.</i>
+</div>
+
+
+
+<h3>Corridor set 2:</h3>
+For the second set, corridors are computed for all edges in the graph 
+(network). This takes a little more time. Corridors are then weighted by 
+the modeled, undirected (= in oth directions) flow of propagules ("cf_u").
+
+<div class="code"><pre>
+r.connectivity.corridors input=hws_connectivity_edge_measures layer=1 \
+weights=cf_u suffix=all corridor_tolerance=0.05 \
+cores=1
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_corridors_cf_u_sum_all.png">
+<img src="r_connectivity_corridors_cf_u_sum_all.png" width="600" height="600" 
+alt="Corridors computed for all connections, weighted by 
+potential flow of propagules." border="0">
+</a><br>
+<i>Figure: Corridors computed for all connections, weighted by 
+potential flow of propagules.</i>
+</div>
+
+Users with a multi-processor computer (e.g. dual-core) may speed up 
+corridor processing by setting cores > 1 r.connectivity.corridors.<br>
+An other means for speeding up processing would be to use integer weights 
+(e.g. by converting edge betweenness to integer afte multiplying with 10 
+to the power of the relevant number of digits). Then <em>r.reclass</em> 
+is used in the script instead of <em>r.recode</em>.<br>
+<br>
+When all analysis is finnished some cleanup may be appropriate, in order 
+to save disk space:<br>
+
+<div class="code"><pre>
+# Add the f-lag (-f) to the following two commands if you are sure you 
+# want to delete all intermediate maps from r.connectivity.*.
+g.remove type=raster pattern=hws_connectivity_corridor_*
+g.remove type=raster pattern=hws_connectivity_patch_*
+</pre></div>
+
+
+<h2>SEE ALSO</h2>
+<em>
+<a href="r.connectivity.distance.html">r.connectivity.distance</a>, 
+<a href="r.connectivity.network.html">r.connectivity.network</a>
+</em>
+
+<h2>AUTHOR</h2>
+Stefan Blumentrath, Norwegian Institute for Nature Research (NINA)
+<br><br>
+<p><i>Last changed: $Date$</i></p>


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.html
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/html
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.py
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.py	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.py	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,484 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+"""
+MODULE:       r.connectivity.corridors
+AUTHOR(S):    Stefan Blumentrath <stefan dot blumentrath at nina dot no >
+PURPOSE:      Compute corridors between habitat patches of an input-
+              layer based on distance raster maps produced by
+              r.connecivity.distance.
+              Corridor-importance can be evaluated based on results from
+              r.connectivity.network.
+
+              Recently, graph-theory has been characterised as an
+              efficient and useful tool for conservation planning
+              (e.g. Bunn et al. 2000, Calabrese & Fagan 2004,
+              Minor & Urban 2008, Zetterberg et. al. 2010).
+              As a part of the r.connectivity.* toolset,
+              r.connectivity.distance is intended to make graph-theory
+              more easily available to conservation planning.
+
+              r.connectivity.corridors is th 3rd tool of the
+              r.connectivity.* toolchain.
+
+              r.connectivity.corridors loops through the attribute-table
+              of the edge- output vector map from r.connectivity.network
+              and computes the corridor for each edge of a user-defined
+              set of edges. r.connectivity.corridors can account for the
+              importance of the corridors for the entire network by
+              reclassifying them with regards to network measures from
+              r.connectivity.network.
+
+              Finally, all individual corridors are being put together
+              using r.series. In this step the values of the cells in
+              all corridor maps are summed up, which indicates the
+              importance of an area (raster cell) for the network of the
+              given patches (either the number of corridors a cell is
+              part of, or other graph-theoretical measures for corridor
+              importance).
+
+              !!!Corridors are only computed for an undirected graph.!!!
+
+              Output raster maps are named according to a user defined
+              prefix and suffix.
+
+COPYRIGHT:    (C) 2011 by the Norwegian Institute for Nature Research
+                  (NINA)
+
+              This program is free software under the GNU General Public
+              License (>=v2). Read the file COPYING that comes with
+              GRASS for details.
+
+########################################################################
+
+REQUIREMENTS:
+
+"""
+
+#%Module
+#% description: Compute corridors between habitat patches of an input-layer based on (cost) distance raster maps
+#% keywords: corridor
+#% keywords: cost distance
+#% keywords: least cost paths
+#%End
+
+#%option G_OPT_V_INPUT
+#% required: yes
+#% key_desc: Result from r.connectivity.network containing edge measures
+#% description: Name of the table containing edge measures from r.connectivity.network
+#%end
+
+#%option G_OPT_V_FIELD
+#% required: yes
+#% answer: 1
+#% description: layer containing patch geometries
+#%end
+
+#%Option G_OPT_DB_COLUMNS
+#% key: weights
+#% type: string
+#% required: no
+#% multiple: yes
+#% key_desc: Column names
+#% description: Column names separated by comma
+#%End
+
+#%Option G_OPT_DB_where
+#% key: where
+#% required: no
+#% key_desc: where (SQL statement)
+#% description: where conditions of SQL statement without 'where' keyword. (example: cf_mst_ud = 1 or cf_eb_ud > 100)
+#%End
+
+#%option
+#% key: suffix
+#% type: string
+#% description: Output suffix for corridor summary result
+#% required : yes
+#%end
+
+#%option
+#% key: corridor_tolerance
+#% type: double
+#% description: Tolerance for deviation from (cost) distance within corridors (in %)
+#% required : no
+#% answer : 0.0
+#%end
+
+#%flag
+#% key: s
+#% description: Show edges selected by where-clause and exit
+#%end
+
+#%flag
+#% key: d
+#% description: Assign distance values to corridors instead of connection ids and weights
+#%end
+
+#%flag
+#% key: r
+#% description: Recalculate already computed corridors (default is only weight and summarize already existing corridor maps)
+#%end
+
+#%option
+#% key: cores
+#% type: integer
+#% description: cores used for multithreading (1 means no multithreading)
+#% required : no
+#% answer : 1
+#%end
+
+
+import atexit
+import os
+import sys
+import string
+import resource
+import copy
+from io import StringIO
+import numpy as np
+import grass.script as grass
+import grass.script.task as task
+from grass.script import vector as vect
+from grass.pygrass.raster.history import History
+from grass.pygrass.modules import Module, ParallelModuleQueue
+
+### To do:
+# Distinguish and remove temporary raster maps (single corridors)
+# Prallelize aggregation (if meaningful)
+# Fix history assignment for single corridors
+# - grass.parse_command('v.support', map=edges, flags='g')[comments]
+# - grass.parse_command('v.support', map=nodes, flags='g')[comments]
+# Add description to history ("Generated by")
+# Add User (creator) to history
+# Add "flow_weighted" corridors (distance * distance_weight * pop_proxy)
+
+# Add "flow map" (distance * distance_weight * pop_proxy) without any
+#     constraints on max distance
+# Maybe as new model r.connectivity.flow (that can be used on
+#    r.connectivity.distance output directly; similar input as
+#    r.connectivity.network (base, exponent, plotting, map generation,
+#    plus where clause for edge selection))
+
+# Check if script is started from within GRASS
+if not os.environ.has_key("GISBASE"):
+    grass.message("You must be in GRASS GIS to run this program.")
+    sys.exit(1)
+
+# Define additional variables
+# global TMP_PREFIX
+# TMP_PREFIX = grass.tempname(12)
+
+def write_raster_history(rastermap):
+    """Write command history to raster map
+    """
+
+    # grass.raster.raster_history('{}_patch_{}_cost_dist'.format(prefix, cat))
+    cdhist = History(rastermap)
+    cdhist.clear()
+    cdhist.creator = os.environ['USER']
+    cdhist.write()
+    # History object cannot modify description
+    grass.run_command('r.support',
+                      map=rastermap,
+                      description='Generated by r.connectivity.corridors',
+                      history=os.environ['CMDLINE'])
+
+def cleanup():
+    """Remove temporary data
+    """
+
+    # grass.run_command("g.remove", type=['vector', 'raster'],
+    #                   pattern='{}*'.format(TMP_PREFIX), quiet=True)
+    grass.del_temp_region()
+
+def main():
+    """Do the real work
+    """
+    #Parse remaining variables
+    network_map = options['input']
+    # network_mapset = network_map.split('@')[0]
+    network = network_map.split('@')[1] if len(network_map.split('@')) > 1 else None
+    suffix = options['suffix']
+    layer = options['layer']
+    corridor_tolerance = options['corridor_tolerance']
+    cores = options['cores']
+    where = None if options['where'] == '' else options['where']
+    weights = options['weights'].split(',')
+    s_flag = flags['s']
+    d_flag = flags['d']
+    r_flag = flags['r']
+
+    ulimit = resource.getrlimit(resource.RLIMIT_NOFILE)
+
+    net_hist_str = grass.read_command('v.info',
+                                      map=network_map,
+                                      flags='h').split('\n')[0].split(': ')[1]
+
+    dist_cmd_dict = task.cmdstring_to_tuple(net_hist_str)
+
+    dist_prefix = dist_cmd_dict[1]['prefix']
+    #network_prefix = dist_cmd_dict[1]['prefix']
+
+    #print(where)
+
+    # in_vertices = dist_cmd_dict[1]['input']
+
+    #Check if db-connection for edge map exists
+    con = vect.vector_db(network_map)[int(layer)]
+    if not con:
+        grass.fatal("Database connection for map {} \
+                    is not defined for layer {}.".format(network,
+                                                         layer))
+
+    #Check if required columns exist and are of required type
+    required_columns = ['con_id_u', 'from_p', 'to_p', 'cd_u']
+    if weights:
+        required_columns += weights
+
+    in_columns = vect.vector_columns(network_map, layer=layer)
+
+    missing_columns = np.setdiff1d(required_columns, in_columns.keys())
+
+    if missing_columns:
+        grass.fatal("Cannot find the following reqired/requested \
+                    column(s) {} in vector map \
+                    {}.".format(', '.join(missing_columns), network))
+
+    #
+    weight_types = []
+    # Check properly if column is numeric
+    for col in required_columns:
+        if in_columns[col]['type'] not in ['INTEGER',
+                                           'DOUBLE PRECISION',
+                                           'REAL']:
+            grass.fatal("Column {} is of type {}. \
+                         Only numeric types (integer, \
+                         real or double precision) \
+                         allowed!".format(col, in_columns[col]['type']))
+
+        if col in weights:
+            weight_types.append(in_columns[col]['type'])
+
+    # Extract necessary informartion on edges from attribute table of
+    # edge map
+    table_io = StringIO(unicode(grass.read_command('v.db.select',
+                                                   flags='c',
+                                                   map=network_map,
+                                                   columns=required_columns,
+                                                   separator=',',
+                                                   where=where)))
+
+    try:
+        table_extract = np.genfromtxt(table_io, delimiter=',',
+                                      dtype=None,
+                                      names=required_columns)
+    except:
+        grass.fatal('No edges selected to compute corridors for...')
+
+    # Output result of where-clause and exit (if requested)
+    if s_flag:
+        print(table_extract)
+        #grass.message("con_id_u|from_p|to_p")
+        #for fid in $selected_edges_ud:
+        #    message_text = $(echo $table_extract | tr ' ' '\n' |
+        # tr ',' ' ' | awk -v FID=$fid '{if($1==FID) print $1 "|" $2 "|"
+        #  $3}' | head -n 1)
+        #    grass.message(message_text)
+        sys.exit(0)
+
+    #Get unique identifiers for the selected undirected edges
+    selected_patches = np.unique(np.append(table_extract['from_p'],
+                                           table_extract['to_p']))
+
+    selected_edges = np.unique(table_extract['con_id_u'])
+
+    # activate z-flag if more maps have to be aggregated than ulimit
+    z_flag = None if len(selected_edges) < ulimit else 'z'
+
+    #Check if cost distance raster maps exist
+    pattern = "{}_patch_*_cost_dist".format(dist_prefix)
+    patchmaps = grass.read_command('g.list',
+                                   pattern=pattern,
+                                   type='raster'
+                                   ).rstrip('\n').split('\n')
+
+    for patch in selected_patches:
+        #Check if cost distance raster maps exist
+        patchmap = "{}_patch_{}_cost_dist".format(dist_prefix, patch)
+        if not patchmap in patchmaps:
+            grass.fatal("Cannot find raster map {}.".format(patchmap))
+
+
+    #Create mapcalculator expressions for cost distance corridors,
+    # assigning distance values
+    corridormaps = {}
+    if d_flag:
+        pattern = "{}_corridor_*_cost_dist".format(dist_prefix)
+        corridor_base = 'dist'
+    else:
+        pattern = "{}_corridor_[0-9]+$".format(dist_prefix)
+        corridor_base = 'id'
+
+    corridormaps[corridor_base] = grass.read_command('g.list',
+                                      flags='e',
+                                      pattern=pattern,
+                                      type='raster'
+                                      ).rstrip('\n').split('\n')
+    for weight in weights:
+        pattern = "{}_corridor_[0-9]+_{}".format(dist_prefix, weight)
+        corridormaps[weight] = grass.read_command('g.list', flags='e',
+                                          pattern=pattern,
+                                          type='raster'
+                                          ).rstrip('\n').split('\n')
+
+    # Setup GRASS modules for raster processing
+    mapcalc = Module("r.mapcalc", quiet=True, run_=False)
+    reclass = Module("r.reclass", rules='-', quiet=True, run_=False)
+    recode = Module("r.recode", rules='-', quiet=True, run_=False)
+
+    # Setup paralel module queue if parallel processing is requested
+    #print(weight_types)
+    if cores > 1:
+        mapcalc_queue = ParallelModuleQueue(nprocs=cores)
+
+        if 'INTEGER' in weight_types:
+            reclass_queue = ParallelModuleQueue(nprocs=cores)
+
+        if 'REAL' in weight_types or 'DOUBLE PRECISION' in weight_types:
+            recode_queue = ParallelModuleQueue(nprocs=cores)
+
+    corridor_list = []
+    for edge_id in selected_edges:
+        edge = table_extract[table_extract['con_id_u'] == edge_id][0]
+        #print(e.dtype.names)
+        if d_flag:
+            corridor = "{}_corridor_{}_cost_dist".format(dist_prefix,
+                                                         edge_id)
+            #corridor_list.append(corridor)
+            mc_expression = "{prefix}_corridor_{CON_ID}_cost_dist=if( \
+            ({prefix}_patch_{FROM_P}_cost_dist+ \
+            {prefix}_patch_{TO_P}_cost_dist) - \
+            (({prefix}_patch_{FROM_P}_cost_dist+ \
+            {prefix}_patch_{TO_P}_cost_dist) * \
+            {cor_tolerance}/100.0)<= \
+            ({prefix}_patch_{FROM_P}_cost_dist + \
+            {prefix}_patch_{TO_P}_cost_dist), \
+            ({prefix}_patch_{FROM_P}_cost_dist+ \
+            {prefix}_patch_{TO_P}_cost_dist), \
+            null())".format(prefix=dist_prefix,
+                            CON_ID=edge['con_id_u'],
+                            FROM_P=edge['from_p'],
+                            TO_P=edge['to_p'],
+                            cor_tolerance=corridor_tolerance)
+        else:
+            corridor = "{}_corridor_{}".format(dist_prefix,
+                                               edge['con_id_u'])
+            #corridor_list.append(corridor)
+            # Create mapcalculator expressions for cost distance
+            # corridors, assigning connection IDs for reclassification
+            mc_expression = "{prefix}_corridor_{CON_ID}=if( \
+            ({prefix}_patch_{FROM_P}_cost_dist+ \
+            {prefix}_patch_{TO_P}_cost_dist)- \
+            (({prefix}_patch_{FROM_P}_cost_dist+ \
+            {prefix}_patch_{TO_P}_cost_dist)* \
+            {cor_tolerance}/100.0)<={CD}, \
+            {CON_ID}, null())".format(prefix=dist_prefix,
+                                      CON_ID=edge['con_id_u'],
+                                      FROM_P=edge['from_p'],
+                                      TO_P=edge['to_p'],
+                                      CD=edge['cd_u'],
+                                      cor_tolerance=corridor_tolerance)
+
+        corridor_list.append(corridor)
+        #print(corridor)
+        #print(corridormaps)
+
+        if r_flag or corridor not in corridormaps[corridor_base]:
+            new_mapcalc = copy.deepcopy(mapcalc)
+
+            if cores > 1:
+                calc = new_mapcalc(expression=mc_expression)
+                mapcalc_queue.put(calc)
+            else:
+                calc = new_mapcalc(expression=mc_expression,
+                                region='intersect')
+                calc.run()
+
+        for weight in weights:
+            if r_flag or corridor not in corridormaps[weight]:
+                in_map = corridor
+                out_map = '{}_{}'.format(in_map, weight)
+                if in_columns[weight]['type'] == 'INTEGER':
+                    new_reclass = copy.deepcopy(reclass)
+                    reclass_rule = "{} = {}".format(edge['con_id_u'],
+                                                    edge[weight])
+                    rcl = new_reclass(input=in_map,
+                                      output=out_map,
+                                      stdin_=reclass_rule)
+
+                    if cores > 1:
+                        reclass_queue.put(rcl)
+                    else:
+                        rcl.run()
+
+                if in_columns[weight]['type'] in ['REAL',
+                                                  'DOUBLE PRECISION']:
+                    new_recode = copy.deepcopy(recode)
+                    recode_rule = "{0}:{0}:{1}:{1}".format(edge['con_id_u'],
+                                                          edge[weight])
+                    rco = new_recode(input=in_map,
+                                     output=out_map,
+                                     stdin_=recode_rule)
+                    if cores > 1:
+                        recode_queue.put(rco)
+                    else:
+                        rco.run()
+
+
+    if cores > 1:
+        mapcalc_queue.wait()
+        if 'INTEGER' in weight_types:
+            reclass_queue.wait()
+        if 'REAL' in weight_types or 'DOUBLE PRECISION' in weight_types:
+            recode_queue.wait()
+
+    grass.verbose('Aggregating corridor maps...')
+
+    if d_flag:
+        grass.run_command('r.series', flags=z_flag, quiet=True,
+                          input=','.join(corridor_list),
+                          output='{}_corridors_min_cost_dist_{}'.format(dist_prefix, suffix),
+                          method='minimum')
+    else:
+        #Summarize corridors
+        if not weights:
+            print(','.join(corridor_list))
+            output_map = '{}_corridors_count_{}'.format(dist_prefix,
+                                                        suffix)
+            grass.run_command('r.series', flags=z_flag, quiet=True,
+                              input=','.join(corridor_list),
+                              output=output_map,
+                              method='count')
+            write_raster_history(output_map)
+
+        else:
+            #Weight corridors according to user requested weights
+            for weight in weights:
+                # Generate corridor map list
+                corridor_map_list = (cm + '_{}'.format(weight) for cm in corridor_list)
+                output_map = '{}_corridors_{}_sum_{}'.format(dist_prefix,
+                                                             weight,
+                                                             suffix)
+                #Summarize corridors using r.series
+                grass.run_command('r.series', flags=z_flag, quiet=True,
+                                  input=corridor_map_list,
+                                  output=output_map,
+                                  method='sum')
+                write_raster_history(output_map)
+
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    atexit.register(cleanup)
+    sys.exit(main())


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r.connectivity.corridors.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_cf_u_sum_all.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_cf_u_sum_all.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_cf_u_sum_all.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_cf_u_sum_all.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_cf_u_sum_all.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_mst_eb.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_mst_eb.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_mst_eb.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_mst_eb.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.corridors/r_connectivity_corridors_mst_eb.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/Makefile
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/Makefile	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/Makefile	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.connectivity.distance
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/Makefile
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-makefile
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.html
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.html	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,344 @@
+<h2>DESCRIPTION:</h2>
+<em>r.connectivity.distance</em> computes cost-distance between all 
+areas (patches) of an input vector map within a user defined euclidean 
+distance threshold.
+
+<p>Recently, graph-theory has been characterised as an efficient and 
+useful tool for conservation planning (e.g. Bunn et al. 2000, 
+Calabrese & Fagan 2004, Minor & Urban 2008, Zetterberg et. al. 2010).</p>
+
+<p>As a part of the r.connectivity.* tool-chain, <em>r.connectivity.distance</em> is 
+intended to make graph-theory more easily available to conservation 
+planning.</p>
+
+<p><em>r.connectivity.distance</em> is the first tool of the 
+r.connectivity.*-toolchain (followed by <em>r.connectivity.network</em> 
+and <em>r.connectivity.corridors</em>).</p>
+
+<p><em>r.connectivity.distance</em> loops through all polygons in the 
+input vector map and calculates the cost-distance to all the other 
+polygons within a user-defined defined euclidean distance threshold.</p>
+
+<p>It produces two vector maps that holde the network:</p>
+<ul>
+<li>an edge-map (connections between patches) and a</li>
+<li>vertex-map (centroid representations of the patches).</li>
+</ul>
+
+<p>Attributes of the edge-map are:</p>
+<table>
+<tr>
+  <td>cat</td>
+  <td>line category</td>
+  <td>integer</td>
+</tr>
+<tr>
+  <td>from_patch</td>
+  <td>category of the start patch</td>
+  <td>integer</td>
+</tr>
+<tr>
+  <td>to_patch</td>
+  <td>category of the destination patch</td>
+  <td>integer</td>
+</tr>
+<tr>
+  <td>dist</td>
+  <td>cost-distance from from_patch to to_patch</td>
+  <td>double precision</td>
+</tr>
+
+</table>
+<p>Attributes of the vertex-map are:</p>
+<table>
+<tr>
+  <td>cat</td>
+  <td>category of the input patches</td>
+  <td>integer</td>
+</tr>
+<tr>
+  <td>pop_proxy</td>
+  <td>the user defined population proxy to be used in further analysis, 
+representing a proxy for the amount of organisms potentially dispersing 
+from a patch (e.g. habitat area)</td>
+  <td>double precision</td>
+</tr>
+</table>
+
+<p>On user request (<b>p-flag</b>) the shortest paths between the possible 
+combination of patches can be extracted (using <em>r.drain</em>), along 
+with start and stop points.</p>
+
+<p>In addition, <em>r.connectivity.distance</em> outputs a cost distance 
+raster map for every input area which later on are used in 
+<em>r.connectivity.corridors</em> (together with output from 
+<em>r.connectivity.network</em>) for corridor identification.</p>
+
+<p>Distance between patches is measured as border to border distance. With 
+the <b>border_dist</b> option, the user can define the number of cells 
+(n) along the border to be used for distance measuring.<br>
+The distance from a (start) patch to another (end) is measured as the 
+n-th closest cell on the border of the other (end) patch. An increased 
+number of border cells used for distance measuring increases also the 
+width of possible corridors computed with 
+<em>r.connectivity.corridors</em> later on.</p>
+
+<p>If an output directory is given for the <b>conefor_dir</b> option is 
+specified, also output suitable for further processing in 
+<a href="http://www.conefor.org">CONEFOR</a> will be produced, namely:</p>
+<ul>
+<li>a node file</li>
+<li>a directed connection file, and</li>
+<li>an undirected connection file</li>
+</ul>
+
+<h2>EXAMPLES</h2>
+The following example is based on the North Carolina dataset!
+<p><em>Please be aware that all input parameter of the following example are 
+purely hypothetical (though they intend to imitate a real life 
+situation) and chosen only for the matter of the exercise. Parameters 
+have to be adjusted in other cases according to ecological knowledge in 
+order to give meaningful results!</em></p>
+
+<p>
+Let us assume we want to analyse the habitat connectivity for a 
+hypothetical species of the Hardwood Swamps in North Carolina. This 
+species lives only in the larger core area of the swamps (> 1ha) while 
+the borders are no suitable habitats.<br>
+It is not the most mobile of species and can cover (under optimal 
+conditions) maximal 1.5 km.
+</p>
+
+<h3>Prepare input data</h3>
+Befor we can run the connectivity analysis with the r.connectivity.*-tools 
+we need to prepare the the example input data. Because we want to use 
+cost distance as a distance measure we have to provide a cost raster map 
+in addition to the required vector map of (habitat) patches:
+
+<h3>Create input patch vector map</h3>
+
+<div class="code"><pre>
+### Set region
+g.region -p rast=landuse96_28m align=landuse96_28m
+
+### Patch input vector map
+## Extract habitat patches
+# Condition 1: Category 11 = Bottomland Hardwoods/Hardwood Swamps
+# Condition 2: no border-cells are suitable  
+r.mapcalc expression="patches=if( \
+landuse96_28m[0,1]==11&& \
+landuse96_28m[0,-1]==11&& \
+landuse96_28m[1,1]==11&& \
+landuse96_28m[1,0]==11&& \
+landuse96_28m[1,-1]==11&& \
+landuse96_28m[-1,1]==11&& \
+landuse96_28m[-1,0]==11&& \
+landuse96_28m[-1,-1]==11&& \
+landuse96_28m==11,1,null())"
+
+# Vectorize patches
+r.to.vect input=patches output=patches feature=area
+
+# Add a column for the population proxy (in this case area in hectares)
+v.db.addcolumn map=patches layer=1 columns="area_ha double precision"
+
+# Upload area to attribute table (later used as population proxy)
+v.to.db map=patches type=point,line,boundary,centroid layer=1 qlayer=1 \
+option=area units=hectares columns=area_ha
+
+#Extract core habitat areas with more than 1 ha
+v.extract input=patches output=patches_1ha type=area layer=1 where="area_ha>1"
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_distance_patches.png">
+<img src="r_connectivity_distance_patches.png" width="600" height="600" 
+alt="Patch vector map example" border="0">
+</a><br>
+<i>Figure: Patch vector map as input to r.connectivity.distance, produced 
+in exampe above.</i>
+</div>
+
+<h3>Create a cost raster:</h3>
+(see also: <em>r.cost</em>)
+
+<p>For the cost raster, we assume that areas which are developed with 
+high intensity are absolute barriers for our species (not crossable at all).<br>
+Other developed and managed areas can be crossed, but only at high costs 
+(they are avoided where possible). Other Hardwood landcover types offer 
+best opportnity for the dispersal of our species (they are prefered), 
+while the costs for crossing the other landcover types is somewhere 
+inbetween.</p>
+<p>Hint: One might also add infrastructure like e.g. roads</p>
+
+<div class="code"><pre>
+# Reclassify land use map
+# Windows users may have to use the GUI version of r.reclass
+# and paste the rules there...
+echo '0 = 56 #not classified (2*resolution (28m))
+1 = NULL #High Intensity Developed (absolut barrier)
+2 = 140 #Low Intensity Developed (5*resolution (28m))
+3 = 112 #Cultivated (4*resolution (28m))
+4 = 70 #Managed Herbaceous Cover (2,5*resolution (28m))
+6 = 28 #Riverine/Estuarine Herbaceous (1*resolution (28m))
+7 = 42 #Evergreen Shrubland (1,5*resolution (28m))
+8 = 42 #Deciduous Shrubland (1,5*resolution (28m))
+9 = 42 #Mixed Shrubland (1,5*resolution (28m))
+10 = 28 #Mixed Hardwoods (1*resolution (28m))
+11 = 28 #Bottomland Hardwoods/Hardwood Swamps (1*resolution (28m))
+15 = 56 #Southern Yellow Pine (2*resolution (28m))
+18 = 28 #Mixed Hardwoods/Conifers (1*resolution (28m))
+20 = 42 #Water Bodies (1,5*resolution (28m))
+21 = 84 #Unconsolidated Sediment (3*resolution (28m))' | r.reclass \
+input=landuse96_28m output=costs rules=- --overwrite 
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_distance_costs.png">
+<img src="r_connectivity_distance_costs.png" width="600" height="600" 
+alt="Cost raster map example" border="0">
+</a><br>
+<i>Figure: Cost raster as input to r.connectivity.distance, produced in 
+exampe above.</i>
+</div>
+
+<h3>Create the network</h3>
+In the first step the network dataset is created, and the cost distance 
+between all possible pairs of vertices (patches) is calculated.
+<p>Our species is known to be uable to cover more than 1.5 km distance. 
+In order to identify potential for improving the connectectivity of the 
+landscape for our speies we set the cutoff distance (maximum search 
+distance for connections) to three times dispersal potential of our 
+species (4500). In lack of real population data we use the area (ha) as 
+a proxy. The distance between two patches is measured as the maximum 
+distance along the closest 500m of boundary of a patch (ca. 18 border 
+cells with 28m resolution). We store the resulting network data also 
+in a format that is suitable as input to CONEFOR software.</p>
+
+<div class="code"><pre>
+r.connectivity.distance -t -p input=patches_1ha pop_proxy=area_ha \
+costs=costs prefix=hws_connectivity cutoff=4500 border_dist=18 \
+conefor_dir=./conefor
+</pre></div>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_distance_shortest_paths.png">
+<img src="r_connectivity_distance_shortest_paths.png" width="600" 
+height="600" alt="Output network represented by shortest paths" border="0">
+</a><br>
+<i>Figure: Network produced with r.connectivity.distance, visually 
+represented by shortest paths and patch areas, produced in exampe above.</i>
+</div>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_distance_network.png">
+<img src="r_connectivity_distance_network.png" width="600" height="600" 
+alt="Output network visualised as a simplified (straight) network" border="0">
+</a><br>
+<i>Figure: Network produced with r.connectivity.distance, simplified 
+visualisation with straight lines, produced in exampe above.</i>
+</div>
+
+<p>To be continued with <a href="r.connectivity.network.html">
+	r.connectivity.network</a>!</p>
+
+<h3>Analyse the network (r.connectivity.network)</h3>
+
+In the next step network analysis is performed. We define the 
+connectivity cutoff (maximum cost distance where connectivity is assumed) 
+to be 1500.0 cost distance units, which represents the maximum known 
+dispersal ability of our species. The dispersal kernel is adjusted to 
+characteristics of this species by setting the exponent to -3, which 
+gives a steeper decrease in successful dispersal with increasing cost 
+distance. Only very few dispersal units of our species are expected to 
+cross more than ca. 900 cost distance units successfully 
+(see: ./hws_connectivity/kernel.eps after running the command or run it 
+with the x-flag (-x) for only displaying the kernel). Connectivity metrics 
+reslults are stored in te attribute table of the vector maps on vertex 
+(patches, map name: "prefix" _ vertex_measures) and edge level 
+(connections, map name: "prefix" _ edge_measures). An overview over 
+connectivity metrics on the graph level (the entire network) is stored 
+in "folder" (./hws_connectivity). We requested also an R-plot of the 
+dispersal kernel and an R-plot givig an overview over network 
+characteristics to be stored in the same folder.
+<p>Users with a multi-processor computer may speed up processing by 
+setting cores > 1 in r.connectivity.network.</p>
+
+<div class="code"><pre>
+r.connectivity.network -y -i folder=./hws_connectivity \
+connectivity_cutoff=1500.0 lnbh_cutoff=2.0 cl_thres=10 exponent=-3 \
+kernel_plot=./hws_connectivity/kernel.eps \
+overview_plot=./hws_connectivity/overview.eps cores=3
+</pre></div>
+
+<h3>Calculate corridors (r.connectivity.corridors)</h3>
+
+In this example two alternative (or to some extent complementary) sets \
+of corridors are calculated:
+<p>
+<em>Corridor set 1:</em><br>
+For the first set, corridors are only computed for the minimum spanning 
+tree (in literture sometimes called the backbone of an ecological network). 
+This is specified in the "where"-parameter. Edge betweenness values are 
+used as weights, which represent the centrality of a connection (edge) 
+in a network (and is therewith a measure of importance). The output is a 
+set of corridor raster maps (named: "prefix" _corridor_ "edge_id" _ "weight") 
+and a summary over all computed corridors 
+(named: "prefix" _corridor_ "edge_id" _ "weight" _sum_ "suffix").</p>
+
+<div class="code"><pre>
+r.connectivity.corridors --verbose folder=./hws_connectivity suffix=mst \
+weights=cf_eb_ud where="cf_mst_ud > 1" cores=3
+</pre></div>
+
+<p><em>Corridor set 2:</em><br>
+For the second set, corridors are computed for all edges in the graph (network). 
+This takes a little more time. Corridors are then weighted by the modeled, 
+undirected (= in oth directions) flow of propagules ("cf_u").</p>
+
+<div class="code"><pre>
+r.connectivity.corridors --verbose folder=./hws_connectivity suffix=alle \
+weights=cf_u cores=3
+</pre></div>
+
+<p>Users with a multi-processor computer may speed up corridor processing by 
+setting cores > 1 r.connectivity.corridors.<br>
+An other means for speeding up processing would be to use integer 
+weights (e.g. by converting edge betweenness to integer afte multiplying 
+with 10 to the power of the relevant number of digits).
+Then <em>r.reclass</em> is used in the script instead of <em>r.recode</em>.</p>
+
+<p>When all analysis is finnished some cleanup may be appropriate, 
+in order to save disk space:</p>
+
+<div class="code"><pre>
+#Add the f-lag (-f) to the following two commands if you are sure you \
+want to delete all intermediate maps from r.connectivity.*.
+g.remove type=raster pattern=hws_connectivity_corridor_*
+g.remove type=raster pattern=hws_connectivity_patch_*
+</pre></div>
+
+<h2>REFERENCE</h2>
+<dl>
+<dt><b>Framstad, E., Blumentrath, S., Erikstad, L. & Bakkestuen, V. 
+2012</b> (in Norwegian): Naturfaglig evaluering av norske verneområder. 
+Verneområdenes funksjon som økologisk nettverk og toleranse 
+for klimaendringer. NINA Rapport 888: 126 pp. Norsk institutt for 
+naturforskning (NINA), Trondheim. 
+<a href="http://www.nina.no/archive/nina/PppBasePdf/rapport/2012/888.pdf">
+	http://www.nina.no/archive/nina/PppBasePdf/rapport/2012/888.pdf</a></dt>
+</dl>
+
+<h2>SEE ALSO</h2>
+<a href="r.cost.html">r.cost</a>
+<a href="r.drain.html">r.drain</a>
+<a href="v.distance.html">v.distance</a>
+<a href="r.connectivity.html">r.connectivity</a>
+<a href="r.connectivity.network.html">r.connectivity.network</a>
+<a href="r.connectivity.corridors.html">r.connectivity.corridors</a>
+
+<h2>AUTHOR</h2>
+Stefan Blumentrath, Norwegian Institute for Nature Research, Oslo, Norway
+
+<p><i>Last changed: $Date$</i>
+


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.html
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/html
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.py
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.py	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.py	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,837 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+"""
+MODULE:       r.connectivity.distance
+AUTHOR(S):    Stefan Blumentrath <stefan . blumentrath at nina . no >
+PURPOSE:      Compute cost-distance between all polygons (patches) of an
+              input vector map within a user defined euclidean distance
+              threshold
+
+              Recently, graph-theory has been characterised as an
+              efficient and useful tool for conservation planning (e.g.
+              Bunn et al. 2000, Calabrese & Fagan 2004,
+              Minor & Urban 2008, Zetterberg et. al. 2010).
+              As a part of the r.connectivity.* tool-chain,
+              r.connectivity.distance is intended to make graph-theory
+              more easily available to conservation planning.
+
+              r.connectivity.distance is the first tool of the
+              r.connectivity.*-toolchain (followed by
+              r.connectivity.network and r.connectivity.corridor).
+              r.connectivity.distance loops through all polygons in the
+              input vector map and calculates the cost-distance to all
+              the other polygons within a user-defined defined Euclidean
+              distance threshold.
+
+              It produces two vector maps that holde the network:
+               - an edge-map (connections between patches) and a
+               - vertex-map (centroid representations of the patches).
+
+              Attributes of the edge-map are:
+              cat: line category
+              from_patch: category of the start patch
+              to_patch: category of the destination patch
+              dist: cost-distance from from_patch to to_patch
+
+              Attributes of the vertex-map are:
+              cat: category of the input patches
+              pop_proxy: containing the user defined population proxy
+                         used in further analysis, representing a proxy
+                         for the amount of organisms potentially
+                         dispersing from a patch (e.g. habitat area).
+
+
+              In addition, r.connectivity.distance outputs a cost
+              distance raster map for every input polygon which later on
+              are used in r.connectivity.corridors (together with output
+              from r.connectivity.network) for corridor identification.
+
+              Distance between patches is measured as border to border
+              distance. The user can define the number of cells (n)
+              along the border to be used for distance measuring.
+              The distance from a (start) polygon to another (end) is
+              measured as the n-th closest cell on the border of the
+              other (end) polygon. An increased number of border cells
+              used for distance measuring affects (increases) also the
+              width of possible corridors computed with
+              r.connectivity.corridor later on.
+
+              If the conefor_dir option is specified also output in
+              CONEFOR formart will be produced, namely
+               - a node file
+               - a directed connection file, and
+               - an undirected connection file
+
+
+COPYRIGHT:    (C) 2018 by the Norwegian Institute for Nature Research
+                              (NINA)
+
+              This program is free software under the GNU General Public
+              License (>=v2). Read the file COPYING that comes with
+              GRASS for details.
+
+Todo:
+- Implement walking distance (r.walk)
+- Write extra module for CONEFOR export?
+    - probability output (exponent, base, weight option)
+    - choose directed vs undirected output
+    - select included/excluded nodes
+    - different distance measures
+"""
+
+#%module
+#% description: Compute cost-distances between patches of an input vector map
+#% keyword: raster
+#% keyword: vector
+#% keyword: connectivity
+#% keyword: cost distance
+#% keyword: walking distance
+#% keyword: least cost path
+#% keyword: Conefor
+#%end
+
+#%option G_OPT_V_INPUT
+#% required: yes
+#% key_desc: patches (input)
+#% description: Name of input vector map containing habitat patches
+#%end
+
+#%option G_OPT_V_FIELD
+#% required: yes
+#% answer: 1
+#% description: layer containing patch geometries
+#%end
+
+#%option G_OPT_DB_COLUMN
+#% key: pop_proxy
+#% required: yes
+#% key_desc: pop_proxy
+#% description: Column containig proxy for population size (not NULL and > 0)
+#%end
+
+#%option G_OPT_R_INPUT
+#% key: costs
+#% required: no
+#% key_desc: costs (input)
+#% description: Name of input costs raster map
+#%end
+
+#%option
+#% key: prefix
+#% type: string
+#% description: Prefix used for all output of the module (network vector map(s) and cost distance raster maps)
+#% required : yes
+#% guisection: Output
+#%end
+
+#%option
+#% key: cutoff
+#% type: double
+#% description: Maximum search distance around patches in meter
+#% required: no
+#% guisection: Settings
+#% answer: 10000
+#%end
+
+#%option
+#% key: border_dist
+#% type: integer
+#% description: Number of border cells used for distance measuring
+#% required : no
+#% guisection: Settings
+#% answer : 50
+#%end
+
+#%option
+#% key: memory
+#% type: integer
+#% description: Maximum memory to be used in MB
+#% required : no
+#% guisection: Settings
+#% answer : 300
+#%end
+
+#%option G_OPT_M_DIR
+#% key: conefor_dir
+#% description: Directory for additional output in Conefor format
+#% required : no
+#% guisection: Output
+#%end
+
+#%flag
+#% key: p
+#% description: Extract and save shortest paths and closest points into a vector map
+#% guisection: Settings
+#%end
+
+#%flag
+#% key: t
+#% description: Rasterize patch borders with "all-touched" option using GDAL
+#% guisection: Settings
+#%end
+
+#%flag
+#% key: r
+#% description: Remove distance maps (saves disk-space but disables computation of corridors)
+#% guisection: Settings
+#%end
+
+#%flag
+#% key: k
+#% description: Use the 'Knight's move'; slower, but more accurate
+#% guisection: Settings
+#%end
+
+##%flag
+##% key: w
+##% description: Use the use walking distance (r.walk) instead of cost distance (r.cost)
+##% guisection: Settings
+##%end
+
+##%option
+##% key: walk_coeff
+##% type: string
+##% description: Coefficients for walking energy formula parameters a,b,c,d
+##% required : no
+##% answer : 0.72,6.0,1.9998,-1.9998
+##% guisection: Movement
+##%end
+
+##%option
+##% key: lambda
+##% type: float
+##% description: Lambda coefficients for combining walking energy and friction cost
+##% required : no
+##% answer : 1.0
+##% guisection: Movement
+##%end
+
+##%option
+##% key: slope_factor
+##% type: float
+##% description: Slope factor determines travel energy cost per height step
+##% required : no
+##% answer : -0.2125
+##% guisection: Movement
+##%end
+
+import atexit
+import os
+import sys
+import string
+import random
+import subprocess
+from io import StringIO
+import numpy as np
+import grass.script as grass
+from grass.pygrass.vector import VectorTopo
+from grass.pygrass.raster.history import History
+from grass.pygrass.vector.geometry import Centroid
+from grass.pygrass.vector.geometry import Point
+from grass.pygrass.vector.geometry import Line
+from osgeo import ogr
+
+# Check if script is started from within GRASS
+if not os.environ.has_key("GISBASE"):
+    grass.message("You must be in GRASS GIS to run this program.")
+    sys.exit(1)
+
+# Define additional variables
+# global TMP_PREFIX
+TMP_PREFIX = grass.tempname(12)
+
+def cleanup():
+    """Remove temporary data
+    """
+    grass.del_temp_region()
+    tmp_maps = grass.read_command("g.list",
+                                  type=['vector', 'raster'],
+                                  pattern='{}*'.format(TMP_PREFIX),
+                                  separator=',')
+
+    if tmp_maps:
+        grass.run_command("g.remove", type=['vector', 'raster'],
+                          pattern='{}*'.format(TMP_PREFIX), quiet=True,
+                          flags='f')
+
+def main():
+    """Do the main processing
+    """
+
+    # Parse input options:
+    patch_map = options['input']
+    patches = patch_map.split('@')[0]
+    patches_mapset = patch_map.split('@')[1] if len(patch_map.split('@')) > 1 else None
+    pop_proxy = options['pop_proxy']
+    layer = options['layer']
+    costs = options['costs']
+    cutoff = float(options['cutoff'])
+    border_dist = int(options['border_dist'])
+    conefor_dir = options['conefor_dir']
+    memory = int(options['memory'])
+
+    # Parse output options:
+    prefix = options['prefix']
+    edge_map = '{}_edges'.format(prefix)
+    vertex_map = '{}_vertices'.format(prefix)
+    shortest_paths = '{}_shortest_paths'.format(prefix)
+
+    # Parse flags:
+    p_flag = flags['p']
+    t_flag = flags['t']
+    r_flag = flags['r']
+
+    dist_flags = 'kn' if flags['k'] else 'n'
+
+    lin_cat = 1
+    zero_dist = None
+
+    folder = grass.tempdir()
+    if not os.path.exists(folder):
+        os.makedirs(folder)
+
+    # Setup counter for progress message
+    counter = 0
+
+    # Check if location is lat/lon (only in lat/lon geodesic distance
+    # measuring is supported)
+    if grass.locn_is_latlong():
+        grass.verbose("Location is lat/lon: Geodesic distance \
+                      measure is used")
+
+    # Check if prefix is legal GRASS name
+    if not grass.legal_name(prefix):
+        grass.fatal('{} is not a legal name for GRASS \
+                    maps.'.format(prefix))
+
+    if prefix[0].isdigit():
+        grass.fatal('Tables names starting with a digit are not SQL \
+                    compliant.'.format(prefix))
+
+    # Check if output maps not already exists or could be overwritten
+    for output in [edge_map, vertex_map, shortest_paths]:
+        if grass.db.db_table_exist(output) and not grass.overwrite():
+            grass.fatal('Vector map <{}> already exists'.format(output))
+
+    # Check if input has required attributes
+    in_db_connection = grass.vector.vector_db(patch_map)
+    if not int(layer) in in_db_connection.keys():
+        grass.fatal('No attribute table connected vector map {} at \
+                    layer {}.'.format(patches, layer))
+
+    #Check if cat column exists
+    pcols = grass.vector.vector_columns(patch_map, layer=layer)
+
+    #Check if cat column exists
+    if not 'cat' in pcols.keys():
+        grass.fatal('Cannot find the reqired column cat in vector map \
+                    {}.'.format(patches))
+
+    #Check if pop_proxy column exists
+    if not pop_proxy in pcols.keys():
+        grass.fatal('Cannot find column {} in vector map \
+                    {}'.format(pop_proxy, patches))
+
+    #Check if pop_proxy column is numeric type
+    if not pcols[pop_proxy]['type'] in ['INTEGER', 'REAL',
+                                        'DOUBLE PRECISION']:
+        grass.fatal('Column {} is of type {}. Only numeric types \
+                    (integer or double precision) \
+                    allowed!'.format(pop_proxy,
+                                     pcols[pop_proxy]['type']))
+
+    #Check if pop_proxy column does not contain values <= 0
+    pop_vals = np.fromstring(grass.read_command('v.db.select',
+                                                flags='c',
+                                                map=patches,
+                                                columns=pop_proxy,
+                                                nv=-9999
+                                                ).rstrip('\n'),
+                             dtype=float, sep='\n')
+
+    if np.min(pop_vals) <= 0:
+        grass.fatal('Column {} contains values <= 0 or NULL. Neither \
+                    values <= 0 nor NULL allowed!}'.format(pop_proxy))
+
+    ##############################################
+    # Use pygrass region instead of grass.parse_command !?!
+    reg = grass.parse_command('g.region', flags='ugp')
+
+    max_n = reg['n']
+    min_s = reg['s']
+    max_e = reg['e']
+    min_w = reg['w']
+    # cost_nsres = reg['nsres']
+    # cost_ewres = reg['ewres']
+
+    # Rasterize patches
+    # http://www.gdal.org/gdal_tutorial.html
+    # http://geoinformaticstutorial.blogspot.no/2012/11/convert-
+    # shapefile-to-raster-with-gdal.html
+    if t_flag:
+        # Rasterize patches with "all-touched" mode using GDAL
+        # Read region-settings (not needed canuse max_n, min_s, max_e,
+        # min_w nsres, ewres...
+        prast = os.path.join(folder, 'patches_rast.tif')
+
+        # Check if GDAL-GRASS plugin is installed
+        if ogr.GetDriverByName('GRASS'):
+            #With GDAL-GRASS plugin
+            #Locate file for patch vector map
+            pfile = grass.parse_command('g.findfile', element='vector',
+                                        file=patches,
+                                        mapset=patches_mapset)['file']
+
+        else:
+            # Without GDAL-GRASS-plugin
+            grass.warning("Cannot find GDAL-GRASS plugin. Consider \
+                          installing it in order to save time for \
+                          all-touched rasterisation")
+            pfile = os.path.join(folder, 'patches_vect.gpkg')
+            # Export patch vector map to temp-file in a GDAL-readable
+            # format (shp)
+            grass.run_command('v.out.ogr', flags='m', quiet=True,
+                              input=patch_map, type='area',
+                              layer=layer, output=pfile,
+                              lco='GEOMETRY_NAME=geom')
+
+        # Rasterize vector map with all-touched option
+        os.system('gdal_rasterize -l {} -at -tr {} {} \
+                  -te {} {} {} {} -ot Uint32 -a cat \
+                  {} {} -q'.format(patches, reg['ewres'],
+                                   reg['nsres'],
+                                   reg['w'],
+                                   reg['s'],
+                                   reg['e'],
+                                   reg['n'],
+                                   pfile,
+                                   prast))
+
+        if not ogr.GetDriverByName('GRASS'):
+            # Remove vector temp-file
+            os.remove(os.path.join(folder, 'patches_vect.gpkg'))
+
+        # Import rasterized patches
+        grass.run_command('r.external', flags='o',
+                          quiet=True,
+                          input=os.path.join(folder,
+                                             'patches_rast.tif'),
+                          output='{}_patches_pol'.format(TMP_PREFIX))
+
+    else:
+        # Simple rasterisation (only area)
+        grass.run_command('v.to.rast', quiet=True,
+                          input=patches, use='cat',
+                          type=['area'], # in G 7.6 also 'centroid'
+                          output='{}_patches_pol'.format(TMP_PREFIX))
+
+    # Extract boundaries from patch raster map
+    grass.run_command('r.mapcalc', expression='{p}_patches_boundary=if(\
+    {p}_patches_pol,\
+    if((\
+    (isnull({p}_patches_pol[-1,0])||| \
+    {p}_patches_pol[-1,0]!={p}_patches_pol)||| \
+    (isnull({p}_patches_pol[0,1])||| \
+    {p}_patches_pol[0,1]!={p}_patches_pol)||| \
+    (isnull({p}_patches_pol[1,0])||| \
+    {p}_patches_pol[1,0]!={p}_patches_pol)||| \
+    (isnull({p}_patches_pol[0,-1])||| \
+    {p}_patches_pol[0,-1]!={p}_patches_pol)), \
+    {p}_patches_pol,null()), null())'.format(p=TMP_PREFIX), quiet=True)
+
+    #Init output vector maps if they are requested by user
+    network = VectorTopo(edge_map)
+    network_columns = [(u'cat', 'INTEGER PRIMARY KEY'),
+                       (u'from_p', 'INTEGER'),
+                       (u'to_p', 'INTEGER'),
+                       (u'min_dist', 'DOUBLE PRECISION'),
+                       (u'dist', 'DOUBLE PRECISION'),
+                       (u'max_dist', 'DOUBLE PRECISION')]
+    network.open('w',
+                 tab_name=edge_map,
+                 tab_cols=network_columns)
+
+    vertex = VectorTopo(vertex_map)
+    vertex_columns = [(u'cat', 'INTEGER PRIMARY KEY'),
+                      (pop_proxy, 'DOUBLE PRECISION'),]
+    vertex.open('w',
+                tab_name=vertex_map,
+                tab_cols=vertex_columns)
+
+    if p_flag:
+        # Init cost paths file for start-patch
+        grass.run_command('v.edit', quiet=True, map=shortest_paths,
+                          tool='create')
+        grass.run_command('v.db.addtable', quiet=True,
+                          map=shortest_paths,
+                          columns="cat integer,\
+                                   from_p integer,\
+                                   to_p integer,\
+                                   dist_min double precision,\
+                                   dist double precision,\
+                                   dist_max double precision")
+
+    vpatches = VectorTopo(patches, mapset=patches_mapset)
+    vpatches.open('r')
+
+    ###Loop through patches
+    vpatch_ids = np.array(vpatches.features_to_wkb_list(feature_type="centroid"),
+                          dtype=[('vid', 'uint32'),
+                                 ('cat', 'uint32'),
+                                 ('geom', '|S10')])
+    cats = set(vpatch_ids['cat'])
+    n_cats = len(cats)
+    if n_cats < len(vpatch_ids['cat']):
+        grass.verbose('At least on MultiPolygon found in patch map.\n \
+                      Using average coordinates of the centroids for \
+                      visual representation of the patch.')
+
+    for cat in cats:
+        grass.verbose("Calculating connectivity-distances for patch \
+                      number {}".format(cat))
+
+        # Filter
+        from_vpatch = vpatch_ids[vpatch_ids['cat'] == cat]
+
+        # Get patch ID
+        if from_vpatch['vid'].size == 1:
+            from_centroid = Centroid(v_id=int(from_vpatch['vid']),
+                                     c_mapinfo=vpatches.c_mapinfo)
+            from_x = from_centroid.x
+            from_y = from_centroid.y
+
+            # Get centroid
+            if not from_centroid:
+                continue
+        else:
+            xcoords = []
+            ycoords = []
+            for f_p in from_vpatch['vid']:
+                centroid = Centroid(v_id=int(f_p),
+                                    c_mapinfo=vpatches.c_mapinfo)
+                xcoords.append(centroid.x)
+                ycoords.append(centroid.y)
+
+                # Get centroid
+                if not from_centroid:
+                    continue
+            from_x = np.average(xcoords)
+            from_y = np.average(xcoords)
+
+        # Get BoundingBox
+        from_bbox = grass.parse_command('v.db.select', map=patch_map,
+                                        flags='r',
+                                        where='cat={}'.format(cat))
+
+        attr_filter = vpatches.table.filters.select(pop_proxy)
+        attr_filter = attr_filter.where("cat={}".format(cat))
+        proxy_val = vpatches.table.execute().fetchone()
+
+        # Prepare start patch
+        start_patch = '{}_patch_{}'.format(TMP_PREFIX, cat)
+        reclass_rule = u'{} = 1\n* = NULL'.format(cat)
+        recl = grass.feed_command('r.reclass', quiet=True,
+                                  input='{}_patches_boundary'.format(TMP_PREFIX),
+                                  output=start_patch,
+                                  rules='-')
+        recl.stdin.write(reclass_rule)
+        recl.stdin.close()
+        recl.wait()
+
+        # Check if patch was rasterised (patches smaller raster resolution and close to larger patches may not be rasterised)
+        grass.parse_command('r.info', flags='r', map=start_patch)
+        if min == 'NULL':
+            grass.warning('Patch {} has not been rasterized and will \
+                          therefore not be treated as part of the \
+                          network. Consider using t-flag or change \
+                          resolution.'.format(cat))
+
+            grass.run_command('g.remove', flags='f', vector=start_patch,
+                              raster=start_patch, quiet=True)
+            continue
+
+        # Prepare stop patches
+        ############################################
+        reg = grass.parse_command('g.region', flags='ug', quiet=True,
+                                  raster=start_patch,
+                                  n=float(from_bbox['n']) + float(cutoff),
+                                  s=float(from_bbox['s']) - float(cutoff),
+                                  e=float(from_bbox['e']) + float(cutoff),
+                                  w=float(from_bbox['w']) - float(cutoff),
+                                  align='{}_patches_pol'.format(TMP_PREFIX))
+
+        north = reg['n'] if max_n > reg['n'] else max_n
+        south = reg['s'] if min_s < reg['s'] else min_s
+        east = reg['e'] if max_e > reg['e'] else max_e
+        west = reg['w'] if min_w < reg['w'] else min_w
+
+        # Set region to patch search radius
+        grass.use_temp_region()
+        grass.run_command('g.region', quiet=True,
+                          n=north, s=south, e=east, w=west,
+                          align='{}_patches_pol'.format(TMP_PREFIX))
+
+        # Create buffer around start-patch as a mask
+        # for cost distance analysis
+        grass.run_command('r.buffer', quiet=True,
+                          input=start_patch,
+                          output='MASK', distances=cutoff)
+        grass.run_command('r.mapcalc', quiet=True,
+                          expression='{pf}_patch_{p}_neighbours_contur=\
+                                     if({pf}_patches_boundary=={p},\
+                                     null(),\
+                                     {pf}_patches_boundary)'.format(pf=TMP_PREFIX, p=cat))
+        grass.run_command('r.mask', flags='r', quiet=True)
+
+        # Calculate cost distance
+        cost_distance_map = '{}_patch_{}_cost_dist'.format(prefix, cat)
+        grass.run_command('r.cost', flags=dist_flags, quiet=True,
+                          overwrite=True, input=costs,
+                          output=cost_distance_map,
+                          start_rast=start_patch, memory=memory)
+
+        #grass.run_command('g.region', flags='up')
+        # grass.raster.raster_history(cost_distance_map)
+        cdhist = History(cost_distance_map)
+        cdhist.clear()
+        cdhist.creator = os.environ['USER']
+        cdhist.write()
+        # History object cannot modify description
+        grass.run_command('r.support',
+                          map=cost_distance_map,
+                          description='Generated by r.connectivity.distance',
+                          history=os.environ['CMDLINE'])
+
+
+        # Export distance at boundaries
+        maps = '{0}_patch_{1}_neighbours_contur,{2}_patch_{1}_cost_dist'
+        maps = maps.format(TMP_PREFIX, cat, prefix),
+
+        connections = StringIO(unicode(grass.read_command('r.stats',
+                                                          flags='1ng',
+                                                          quiet=True,
+                                                          input=maps,
+                                                          separator=';').rstrip('\n')))
+        try:
+            con_array = np.genfromtxt(connections, delimiter=';',
+                                      dtype=None,
+                                      names=['x', 'y', 'cat', 'dist'])
+        except:
+            grass.warning('No connections for patch {}'.format(cat))
+
+            # Write centroid to vertex map
+            vertex.write(Point(from_x, from_y),
+                         cat=int(cat),
+                         attrs=proxy_val)
+            vertex.table.conn.commit()
+
+            # Remove temporary map data
+            grass.run_command('g.remove', quiet=True, flags='f',
+                              type=['raster', 'vector'],
+                              pattern="{}*{}*".format(TMP_PREFIX, cat))
+            continue
+
+        #Find closest points on neigbours patches to temporary file
+        to_cats = set(con_array['cat'])
+        to_coords = []
+        for to_cat in to_cats:
+            connection = con_array[con_array['cat'] == to_cat]
+            connection.sort(order=['dist'])
+            pixel = border_dist if len(connection) > border_dist else len(connection) - 1
+            # closest_points_x = connection['x'][pixel]
+            # closest_points_y = connection['y'][pixel]
+            closest_points_to_cat = to_cat
+            closest_points_min_dist = connection['dist'][0]
+            closest_points_dist = connection['dist'][pixel]
+            closest_points_max_dist = connection['dist'][-1]
+            vpatch_id = int(vpatch_ids[vpatch_ids['cat'] == int(to_cat)]['vid'])
+            to_centroid = Centroid(v_id=vpatch_id,
+                                   c_mapinfo=vpatches.c_mapinfo)
+            to_coords.append('{},{},{},{},{},{}'.format(connection['x'][0],
+                                                  connection['y'][0],
+                                                  to_cat,
+                                                  closest_points_min_dist,
+                                                  closest_points_dist,
+                                                  closest_points_max_dist
+                                                  ))
+
+            #Save edges to network dataset
+            if closest_points_dist <= 0:
+                zero_dist = 1
+
+            # Write data to network
+            network.write(Line([(from_x, from_y),
+                                (to_centroid.x, to_centroid.y)]),
+                          cat=lin_cat,
+                          attrs=(cat,
+                                 int(closest_points_to_cat),
+                                 closest_points_min_dist,
+                                 closest_points_dist,
+                                 closest_points_max_dist,))
+            network.table.conn.commit()
+
+            lin_cat = lin_cat + 1
+
+        # Save closest points and shortest paths through cost raster as
+        # vector map (r.drain limited to 1024 points) if requested
+        if p_flag:
+            grass.verbose('Extracting shortest paths for patch number \
+                          {}...'.format(cat))
+
+            points_n = len(to_cats)
+
+            tiles = int(points_n / 1024.0)
+            rest = points_n % 1024
+            if not rest == 0:
+                tiles = tiles + 1
+
+            tile_n = 0
+            while tile_n < tiles:
+                tile_n = tile_n + 1
+                #Import closest points for start-patch in 1000er blocks
+                sp = grass.feed_command('v.in.ascii', flags='nr',
+                                  overwrite=True, quiet=True,
+                                  input='-', stderr=subprocess.PIPE,
+                                  output="{}_{}_cp".format(TMP_PREFIX,
+                                                           cat),
+                                  separator=",",
+                                  columns="x double precision,\
+                                           y double precision,\
+                                           to_p integer,\
+                                           dist_min double precision,\
+                                           dist double precision,\
+                                           dist_max double precision")
+                sp.stdin.write("\n".join(to_coords))
+                sp.stdin.close()
+                sp.wait()
+
+                # Extract shortest paths for start-patch in chunks of
+                # 1024 points
+                cost_paths = "{}_{}_cost_paths".format(TMP_PREFIX, cat)
+                start_points = "{}_{}_cp".format(TMP_PREFIX, cat)
+                grass.run_command('r.drain', overwrite=True, quiet=True,
+                                  input=cost_distance_map,
+                                  output=cost_paths,
+                                  drain=cost_paths,
+                                  start_points=start_points)
+
+                grass.run_command('v.db.addtable',
+                                  map=cost_paths,
+                                  quiet=True,
+                                  columns="cat integer,\
+                                   from_p integer,\
+                                   to_p integer,\
+                                   dist_min double precision,\
+                                   dist double precision,\
+                                   dist_max double precision")
+                grass.run_command('v.db.update', map=cost_paths,
+                                  column='from_p', value=cat,
+                                  quiet=True)
+                grass.run_command('v.distance', quiet=True,
+                                  from_=cost_paths,
+                                  to=start_points,
+                                  upload='to_attr',
+                                  column='to_p',
+                                  to_column='to_p')
+                grass.run_command('v.db.join', quiet=True,
+                                  map=cost_paths,
+                                  column='to_p', other_column='to_p',
+                                  other_table=start_points,
+                                  subset_columns='dist_min,dist,dist_max')
+
+                #grass.run_command('v.info', flags='c',
+                #                  map=cost_paths)
+                grass.run_command('v.patch', flags='ae', overwrite=True,
+                                  quiet=True,
+                                  input=cost_paths,
+                                  output=shortest_paths)
+
+                # Remove temporary map data
+                grass.run_command('g.remove', quiet=True, flags='f',
+                                  type=['raster', 'vector'],
+                                  pattern="{}*{}*".format(TMP_PREFIX,
+                                                          cat))
+
+        # Remove temporary map data for patch
+        if r_flag:
+            grass.run_command('g.remove', flags='f', type='raster',
+                              name=cost_distance_map,
+                              quiet=True)
+
+        vertex.write(Point(from_x, from_y),
+                     cat=int(cat),
+                     attrs=proxy_val)
+
+        vertex.table.conn.commit()
+
+        # Print progress message
+        grass.percent(i=int((float(counter) / n_cats) * 100),
+                      n=100,
+                      s=3)
+
+        # Update counter for progress message
+        counter = counter + 1
+
+    if zero_dist:
+        grass.warning('Some patches are directly adjacent to others. \
+                       Minimum distance set to 0.0000000001')
+
+    # Close vector maps and build topology
+    network.close()
+    vertex.close()
+
+    # Add vertex attributes
+    # grass.run_command('v.db.addtable', map=vertex_map)
+    # grass.run_command('v.db.join', map=vertex_map, column='cat',
+    #                   other_table=in_db_connection[int(layer)]['table'],
+    #                   other_column='cat', subset_columns=pop_proxy,
+    #                   quiet=True)
+
+    # Add history and meta data to produced maps
+    grass.run_command('v.support', flags='h', map=edge_map,
+                      person=os.environ['USER'],
+                      cmdhist=os.environ['CMDLINE'])
+
+    grass.run_command('v.support', flags='h', map=vertex_map,
+                      person=os.environ['USER'],
+                      cmdhist=os.environ['CMDLINE'])
+
+    if shortest_paths:
+        grass.run_command('v.support', flags='h', map=shortest_paths,
+                          person=os.environ['USER'],
+                          cmdhist=os.environ['CMDLINE'])
+
+    # Output also Conefor files if requested
+    if conefor_dir:
+        query = """SELECT p_from, p_to, avg(dist) FROM
+                 (SELECT
+                 CASE
+                 WHEN from_p > to_p THEN to_p
+                 ELSE from_p END AS p_from,
+                    CASE
+                 WHEN from_p > to_p THEN from_p
+                 ELSE to_p END AS p_to,
+                 dist
+                 FROM {}) AS x
+                 GROUP BY p_from, p_to""".format(edge_map)
+        with open(os.path.join(conefor_dir,
+                               'undirected_connection_file'),
+                  'w') as edges:
+            edges.write(grass.read_command('db.select', sql=query,
+                                           separator=' '))
+        with open(os.path.join(conefor_dir,
+                               'directed_connection_file'),
+                  'w') as edges:
+            edges.write(grass.read_command('v.db.select', map=edge_map,
+                                           separator=' ', flags='c'))
+        with open(os.path.join(conefor_dir, 'node_file'), 'w') as nodes:
+            nodes.write(grass.read_command('v.db.select',
+                                           map=vertex_map,
+                                           separator=' ', flags='c'))
+
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    atexit.register(cleanup)
+    sys.exit(main())


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r.connectivity.distance.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_costs.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_costs.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_costs.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_costs.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_costs.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_network.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_network.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_network.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_network.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_network.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_patches.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_patches.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_patches.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_patches.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_patches.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_shortest_paths.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_shortest_paths.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_shortest_paths.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_shortest_paths.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.distance/r_connectivity_distance_shortest_paths.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.html
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.html	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>GRASS GIS manual: r.connectivity</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="grassdocs.css" type="text/css">
+</head>
+<body bgcolor="white">
+<div id="container">
+
+<a href="index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
+<hr class="header">
+
+<h2>NAME</h2>
+<em><b>r.connectivity</b></em> - Conduct connectivity analysis of 
+ecological networks.
+
+<h2>KEYWORDS</h2>
+<a href="raster.html">raster</a>, <a href="vector.html">vector</a>
+
+<!-- meta page description: Conduct connectivity analysis of 
+ecological networks. -->
+
+<h2>DESCRIPTION</h2>
+<em>r.connectivity</em> is a toolset for conducting connectivity analysis 
+of ecological networks. The toolset consists of three modules:
+<ul>
+<li><a href="r.connectivity.distance.html">r.connectivity.distance</a></li>
+<li><a href="r.connectivity.network.html">r.connectivity.network</a></li>
+<li><a href="r.connectivity.corridors.html">r.connectivity.corridors</a></li>
+</ul>
+
+<p>All the modules of the r.connectivity toolset can be installed in 
+GRASS as follows:</p>
+
+<div class="code"><pre>
+g.extension operation=add extension=r.connectivity
+</pre></div>
+
+<h2>NOTES</h2>
+
+The tools require the following underlying libraries and software:<br>
+<ul>
+<li>Cran R</li>
+<li>igraph and the igraph package for R</li>
+<li>ghostscript</li>
+</ul>
+
+<h2>EXAMPLE</h2>
+An example for a full workflow is provided in the manual of the individual 
+tools applied in the following order:
+  <a href="r.connectivity.distance.html">r.connectivity.distance</a>,
+  <a href="r.connectivity.network.html">r.connectivity.network</a>
+  <a href="r.connectivity.corridors.html">r.connectivity.corridors</a>
+
+
+<h2>REFERENCE</h2>
+<dl>
+<dt><b>Framstad, E., Blumentrath, S., Erikstad, L. & Bakkestuen, V. 2012</b> 
+(in Norwegian): Naturfaglig evaluering av norske verneområder. 
+Verneområdenes funksjon som økologisk nettverk og toleranse 
+for klimaendringer. NINA Rapport 888: 126 pp. Norsk institutt for 
+naturforskning (NINA), Trondheim. 
+<a href="http://www.nina.no/archive/nina/PppBasePdf/rapport/2012/888.pdf">
+	http://www.nina.no/archive/nina/PppBasePdf/rapport/2012/888.pdf</a></dt>
+</dl>
+
+<h2>SEE ALSO</h2>
+
+<em>
+  <a href="r.connectivity.distance.html">r.connectivity.distance</a>,
+  <a href="r.connectivity.network.html">r.connectivity.network</a>
+  <a href="r.connectivity.corridors.html">r.connectivity.corridors</a>
+  <a href="r.cost.html">r.cost</a>
+  <a href="v.distance.html">v.distance</a>
+</em>
+
+<h2>AUTHORS</h2>
+
+For authors, please refer to each module of r.connectivity.
+
+<p><i>Last changed: $Date$</i>


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.html
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/html
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/Makefile
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/Makefile	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/Makefile	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.connectivity.network
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/Makefile
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-makefile
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/kernel.eps
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/kernel.eps	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/kernel.eps	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,1733 @@
+%!PS-Adobe-3.0
+%%DocumentNeededResources: font Helvetica
+%%+ font Helvetica-Bold
+%%+ font Helvetica-Oblique
+%%+ font Helvetica-BoldOblique
+%%+ font Symbol
+%%DocumentMedia: a4 595 841 0 () ()
+%%Title: R Graphics Output
+%%Creator: R Software
+%%Pages: (atend)
+%%Orientation: Portrait
+%%BoundingBox: 172 295 424 547
+%%EndComments
+%%BeginProlog
+/bp  { gs sRGB gs } def
+% begin .ps.prolog
+/gs  { gsave } bind def
+/gr  { grestore } bind def
+/ep  { showpage gr gr } bind def
+/m   { moveto } bind def
+/l  { rlineto } bind def
+/np  { newpath } bind def
+/cp  { closepath } bind def
+/f   { fill } bind def
+/o   { stroke } bind def
+/c   { newpath 0 360 arc } bind def
+/r   { 4 2 roll moveto 1 copy 3 -1 roll exch 0 exch rlineto 0 rlineto -1 mul 0 exch rlineto closepath } bind def
+/p1  { stroke } bind def
+/p2  { gsave bg fill grestore newpath } bind def
+/p3  { gsave bg fill grestore stroke } bind def
+/p6  { gsave bg eofill grestore newpath } bind def
+/p7  { gsave bg eofill grestore stroke } bind def
+/t   { 5 -2 roll moveto gsave rotate
+       1 index stringwidth pop
+       mul neg 0 rmoveto show grestore } bind def
+/ta  { 4 -2 roll moveto gsave rotate show } bind def
+/tb  { 2 -1 roll 0 rmoveto show } bind def
+/cl  { grestore gsave newpath 3 index 3 index moveto 1 index
+       4 -1 roll lineto  exch 1 index lineto lineto
+       closepath clip newpath } bind def
+/rgb { setrgbcolor } bind def
+/s   { scalefont setfont } bind def
+% end   .ps.prolog
+/sRGB { [ /CIEBasedABC
+          << /DecodeLMN
+               [ { dup 0.03928 le
+                        {12.92321 div}
+                        {0.055 add 1.055 div 2.4 exp }
+                     ifelse
+                 } bind dup dup
+               ]
+             /MatrixLMN [0.412457 0.212673 0.019334
+                         0.357576 0.715152 0.119192
+                         0.180437 0.072175 0.950301]
+             /WhitePoint [0.9505 1.0 1.0890]
+           >>
+         ] setcolorspace } bind def
+/srgb { setcolor } bind def
+% begin encoding
+/CP1257Encoding [
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle
+ /parenleft /parenright /asterisk /plus /comma /minus /period /slash
+ /zero /one /two /three /four /five /six /seven
+ /eight /nine /colon /semicolon /less /equal /greater /question
+ /at /A /B /C /D /E /F /G
+ /H /I /J /K /L /M /N /O
+ /P /Q /R /S /T /U /V /W
+ /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
+ /grave /a /b /c /d /e /f /g
+ /h /i /j /k /l /m /n /o
+ /p /q /r /s /t /u /v /w
+ /x /y /z /braceleft /bar /braceright /asciitilde /.notdef
+ /Euro /.notdef /quotesinglbase /.notdef /quotedblbase /ellipsis /dagger /daggerdbl
+ /.notdef /perthousand /.notdef /guilsinglleft /.notdef /dieresis /caron /cedilla
+ /.notdef /quoteleft /quoteright /quotedblleft /quotedblright /bullet /endash /emdash
+ /.notdef /trademark /.notdef /guilsinglright /.notdef /macron /ogonek /.notdef
+ /space /.notdef /cent /sterling /currency /.notdef /brokenbar /section
+ /Oslash /copyright /Rcommaaccent /guillemotleft /logicalnot /hyphen /registered /AE
+ /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered
+ /oslash /onesuperior /rcommaaccent /guillemotright /onequarter /onehalf /threequarters /ae
+ /Aogonek /Iogonek /Amacron /Cacute /Adieresis /Aring /Eogonek /Emacron
+ /Ccaron /Eacute /Zacute /Edotaccent /Gcommaaccent /Kcommaaccent /Imacron /Lcommaaccent
+ /Scaron /Nacute /Ncommaaccent /Oacute /Omacron /Otilde /Odieresis /multiply
+ /Uogonek /Lslash /Sacute /Umacron /Udieresis /Zdotaccent /Zcaron /germandbls
+ /aogonek /iogonek /amacron /cacute /adieresis /aring /eogonek /emacron
+ /ccaron /eacute /zacute /edotaccent /gcommaaccent /kcommaaccent /imacron /lcommaaccent
+ /scaron /nacute /ncommaaccent /oacute /omacron /otilde /odieresis /divide
+ /uogonek /lslash /sacute /umacron /udieresis /zdotaccent /zcaron /dotaccent
+]
+ def
+% end encoding
+%%IncludeResource: font Helvetica
+/Helvetica findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font1 exch definefont pop
+%%IncludeResource: font Helvetica-Bold
+/Helvetica-Bold findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font2 exch definefont pop
+%%IncludeResource: font Helvetica-Oblique
+/Helvetica-Oblique findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font3 exch definefont pop
+%%IncludeResource: font Helvetica-BoldOblique
+/Helvetica-BoldOblique findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font4 exch definefont pop
+%%IncludeResource: font Symbol
+/Symbol findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  currentdict
+  end
+/Font5 exch definefont pop
+%%EndProlog
+%%Page: 1 1
+bp
+201.16 331.66 408.52 517.42 cl
+0 0 0 srgb
+0.75 setlinewidth
+[] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+208.84 510.54 m
+0.13 -0.52 l
+0.12 -0.52 l
+0.13 -0.51 l
+0.13 -0.52 l
+0.13 -0.51 l
+0.13 -0.52 l
+0.12 -0.51 l
+0.13 -0.51 l
+0.13 -0.51 l
+0.13 -0.51 l
+0.13 -0.50 l
+0.12 -0.51 l
+0.13 -0.50 l
+0.13 -0.50 l
+0.13 -0.50 l
+0.13 -0.50 l
+0.12 -0.49 l
+0.13 -0.50 l
+0.13 -0.49 l
+0.13 -0.49 l
+0.13 -0.49 l
+0.12 -0.49 l
+0.13 -0.49 l
+0.13 -0.49 l
+0.13 -0.48 l
+0.13 -0.49 l
+0.12 -0.48 l
+0.13 -0.48 l
+0.13 -0.48 l
+0.13 -0.48 l
+0.13 -0.47 l
+0.12 -0.48 l
+0.13 -0.47 l
+0.13 -0.47 l
+0.13 -0.47 l
+0.13 -0.47 l
+0.12 -0.47 l
+0.13 -0.46 l
+0.13 -0.47 l
+0.13 -0.46 l
+0.13 -0.47 l
+0.12 -0.46 l
+0.13 -0.46 l
+0.13 -0.45 l
+0.13 -0.46 l
+0.13 -0.46 l
+0.12 -0.45 l
+0.13 -0.45 l
+0.13 -0.45 l
+0.13 -0.45 l
+0.13 -0.45 l
+0.12 -0.45 l
+0.13 -0.44 l
+0.13 -0.45 l
+0.13 -0.44 l
+0.13 -0.44 l
+0.12 -0.44 l
+0.13 -0.44 l
+0.13 -0.44 l
+0.13 -0.44 l
+0.13 -0.43 l
+0.12 -0.44 l
+0.13 -0.43 l
+0.13 -0.43 l
+0.13 -0.43 l
+0.13 -0.43 l
+0.12 -0.43 l
+0.13 -0.42 l
+0.13 -0.43 l
+0.13 -0.42 l
+0.13 -0.42 l
+0.12 -0.42 l
+0.13 -0.42 l
+0.13 -0.42 l
+0.13 -0.42 l
+0.13 -0.42 l
+0.12 -0.41 l
+0.13 -0.41 l
+0.13 -0.42 l
+0.13 -0.41 l
+0.13 -0.41 l
+0.12 -0.41 l
+0.13 -0.40 l
+0.13 -0.41 l
+0.13 -0.40 l
+0.13 -0.41 l
+0.12 -0.40 l
+0.13 -0.40 l
+0.13 -0.40 l
+0.13 -0.40 l
+0.13 -0.40 l
+0.12 -0.40 l
+0.13 -0.39 l
+0.13 -0.39 l
+0.13 -0.40 l
+0.13 -0.39 l
+0.12 -0.39 l
+0.13 -0.39 l
+0.13 -0.39 l
+221.64 465.46 lineto
+0.13 -0.38 l
+0.12 -0.39 l
+0.13 -0.38 l
+0.13 -0.38 l
+0.13 -0.38 l
+0.13 -0.38 l
+0.12 -0.38 l
+0.13 -0.38 l
+0.13 -0.38 l
+0.13 -0.37 l
+0.13 -0.38 l
+0.12 -0.37 l
+0.13 -0.37 l
+0.13 -0.37 l
+0.13 -0.37 l
+0.13 -0.37 l
+0.12 -0.37 l
+0.13 -0.37 l
+0.13 -0.36 l
+0.13 -0.37 l
+0.13 -0.36 l
+0.12 -0.36 l
+0.13 -0.37 l
+0.13 -0.36 l
+0.13 -0.36 l
+0.13 -0.35 l
+0.12 -0.36 l
+0.13 -0.36 l
+0.13 -0.35 l
+0.13 -0.36 l
+0.13 -0.35 l
+0.12 -0.35 l
+0.13 -0.35 l
+0.13 -0.35 l
+0.13 -0.35 l
+0.13 -0.35 l
+0.12 -0.34 l
+0.13 -0.35 l
+0.13 -0.34 l
+0.13 -0.35 l
+0.13 -0.34 l
+0.12 -0.34 l
+0.13 -0.34 l
+0.13 -0.34 l
+0.13 -0.34 l
+0.13 -0.33 l
+0.12 -0.34 l
+0.13 -0.34 l
+0.13 -0.33 l
+0.13 -0.33 l
+0.13 -0.34 l
+0.12 -0.33 l
+0.13 -0.33 l
+0.13 -0.33 l
+0.13 -0.32 l
+0.13 -0.33 l
+0.12 -0.33 l
+0.13 -0.32 l
+0.13 -0.33 l
+0.13 -0.32 l
+0.13 -0.32 l
+0.12 -0.32 l
+0.13 -0.33 l
+0.13 -0.31 l
+0.13 -0.32 l
+0.13 -0.32 l
+0.12 -0.32 l
+0.13 -0.31 l
+0.13 -0.32 l
+0.13 -0.31 l
+0.13 -0.31 l
+0.12 -0.32 l
+0.13 -0.31 l
+0.13 -0.31 l
+0.13 -0.31 l
+0.13 -0.31 l
+0.12 -0.30 l
+0.13 -0.31 l
+0.13 -0.30 l
+0.13 -0.31 l
+0.13 -0.30 l
+0.12 -0.30 l
+0.13 -0.31 l
+0.13 -0.30 l
+0.13 -0.30 l
+0.13 -0.30 l
+0.12 -0.29 l
+0.13 -0.30 l
+0.13 -0.30 l
+0.13 -0.29 l
+0.13 -0.30 l
+0.12 -0.29 l
+0.13 -0.30 l
+0.13 -0.29 l
+0.13 -0.29 l
+0.13 -0.29 l
+0.12 -0.29 l
+0.13 -0.29 l
+0.13 -0.28 l
+234.44 432.07 lineto
+0.13 -0.29 l
+0.12 -0.28 l
+0.13 -0.29 l
+0.13 -0.28 l
+0.13 -0.28 l
+0.13 -0.28 l
+0.12 -0.28 l
+0.13 -0.28 l
+0.13 -0.28 l
+0.13 -0.28 l
+0.13 -0.28 l
+0.12 -0.28 l
+0.13 -0.27 l
+0.13 -0.28 l
+0.13 -0.27 l
+0.13 -0.27 l
+0.12 -0.28 l
+0.13 -0.27 l
+0.13 -0.27 l
+0.13 -0.27 l
+0.13 -0.27 l
+0.12 -0.27 l
+0.13 -0.27 l
+0.13 -0.26 l
+0.13 -0.27 l
+0.13 -0.26 l
+0.12 -0.27 l
+0.13 -0.26 l
+0.13 -0.26 l
+0.13 -0.27 l
+0.13 -0.26 l
+0.12 -0.26 l
+0.13 -0.26 l
+0.13 -0.26 l
+0.13 -0.26 l
+0.13 -0.25 l
+0.12 -0.26 l
+0.13 -0.26 l
+0.13 -0.25 l
+0.13 -0.26 l
+0.13 -0.25 l
+0.12 -0.25 l
+0.13 -0.25 l
+0.13 -0.26 l
+0.13 -0.25 l
+0.13 -0.25 l
+0.12 -0.24 l
+0.13 -0.25 l
+0.13 -0.25 l
+0.13 -0.25 l
+0.13 -0.24 l
+0.12 -0.25 l
+0.13 -0.24 l
+0.13 -0.25 l
+0.13 -0.24 l
+0.13 -0.24 l
+0.12 -0.24 l
+0.13 -0.25 l
+0.13 -0.24 l
+0.13 -0.24 l
+0.13 -0.23 l
+0.12 -0.24 l
+0.13 -0.24 l
+0.13 -0.24 l
+0.13 -0.23 l
+0.13 -0.24 l
+0.12 -0.23 l
+0.13 -0.24 l
+0.13 -0.23 l
+0.13 -0.23 l
+0.13 -0.23 l
+0.12 -0.24 l
+0.13 -0.23 l
+0.13 -0.23 l
+0.13 -0.22 l
+0.13 -0.23 l
+0.12 -0.23 l
+0.13 -0.23 l
+0.13 -0.22 l
+0.13 -0.23 l
+0.13 -0.22 l
+0.12 -0.23 l
+0.13 -0.22 l
+0.13 -0.22 l
+0.13 -0.23 l
+0.13 -0.22 l
+0.12 -0.22 l
+0.13 -0.22 l
+0.13 -0.22 l
+0.13 -0.22 l
+0.13 -0.22 l
+0.12 -0.21 l
+0.13 -0.22 l
+0.13 -0.22 l
+0.13 -0.21 l
+0.13 -0.22 l
+0.12 -0.21 l
+0.13 -0.22 l
+0.13 -0.21 l
+247.24 407.33 lineto
+0.13 -0.21 l
+0.12 -0.21 l
+0.13 -0.22 l
+0.13 -0.21 l
+0.13 -0.20 l
+0.13 -0.21 l
+0.12 -0.21 l
+0.13 -0.21 l
+0.13 -0.21 l
+0.13 -0.20 l
+0.13 -0.21 l
+0.12 -0.20 l
+0.13 -0.21 l
+0.13 -0.20 l
+0.13 -0.20 l
+0.13 -0.21 l
+0.12 -0.20 l
+0.13 -0.20 l
+0.13 -0.20 l
+0.13 -0.20 l
+0.13 -0.20 l
+0.12 -0.20 l
+0.13 -0.20 l
+0.13 -0.19 l
+0.13 -0.20 l
+0.13 -0.20 l
+0.12 -0.19 l
+0.13 -0.20 l
+0.13 -0.19 l
+0.13 -0.20 l
+0.13 -0.19 l
+0.12 -0.19 l
+0.13 -0.20 l
+0.13 -0.19 l
+0.13 -0.19 l
+0.13 -0.19 l
+0.12 -0.19 l
+0.13 -0.19 l
+0.13 -0.19 l
+0.13 -0.19 l
+0.13 -0.19 l
+0.12 -0.18 l
+0.13 -0.19 l
+0.13 -0.19 l
+0.13 -0.18 l
+0.13 -0.19 l
+0.12 -0.18 l
+0.13 -0.19 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.12 -0.19 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.12 -0.18 l
+0.13 -0.18 l
+0.13 -0.17 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.12 -0.17 l
+0.13 -0.18 l
+0.13 -0.18 l
+0.13 -0.17 l
+0.13 -0.17 l
+0.12 -0.18 l
+0.13 -0.17 l
+0.13 -0.17 l
+0.13 -0.18 l
+0.13 -0.17 l
+0.12 -0.17 l
+0.13 -0.17 l
+0.13 -0.17 l
+0.13 -0.17 l
+0.13 -0.17 l
+0.12 -0.17 l
+0.13 -0.17 l
+0.13 -0.16 l
+0.13 -0.17 l
+0.13 -0.17 l
+0.12 -0.16 l
+0.13 -0.17 l
+0.13 -0.16 l
+0.13 -0.17 l
+0.13 -0.16 l
+0.12 -0.17 l
+0.13 -0.16 l
+0.13 -0.16 l
+0.13 -0.16 l
+0.13 -0.17 l
+0.12 -0.16 l
+0.13 -0.16 l
+0.13 -0.16 l
+0.13 -0.16 l
+0.13 -0.16 l
+0.12 -0.16 l
+0.13 -0.15 l
+0.13 -0.16 l
+260.04 389.00 lineto
+0.13 -0.16 l
+0.12 -0.15 l
+0.13 -0.16 l
+0.13 -0.15 l
+0.13 -0.16 l
+0.13 -0.15 l
+0.12 -0.16 l
+0.13 -0.15 l
+0.13 -0.16 l
+0.13 -0.15 l
+0.13 -0.15 l
+0.12 -0.15 l
+0.13 -0.15 l
+0.13 -0.15 l
+0.13 -0.16 l
+0.13 -0.15 l
+0.12 -0.14 l
+0.13 -0.15 l
+0.13 -0.15 l
+0.13 -0.15 l
+0.13 -0.15 l
+0.12 -0.15 l
+0.13 -0.14 l
+0.13 -0.15 l
+0.13 -0.15 l
+0.13 -0.14 l
+0.12 -0.15 l
+0.13 -0.14 l
+0.13 -0.15 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.12 -0.15 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.12 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.12 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.13 -0.14 l
+0.13 -0.13 l
+0.12 -0.14 l
+0.13 -0.14 l
+0.13 -0.13 l
+0.13 -0.14 l
+0.13 -0.13 l
+0.12 -0.14 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.13 -0.14 l
+0.13 -0.13 l
+0.12 -0.13 l
+0.13 -0.14 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.12 -0.13 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.12 -0.13 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.13 -0.12 l
+0.13 -0.13 l
+0.12 -0.13 l
+0.13 -0.12 l
+0.13 -0.13 l
+0.13 -0.13 l
+0.13 -0.12 l
+0.12 -0.13 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.13 -0.13 l
+0.13 -0.12 l
+0.12 -0.12 l
+0.13 -0.13 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.12 -0.12 l
+0.13 -0.13 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.12 -0.12 l
+0.13 -0.11 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.13 -0.12 l
+0.12 -0.12 l
+0.13 -0.11 l
+0.13 -0.12 l
+272.84 375.42 lineto
+0.13 -0.11 l
+0.12 -0.12 l
+0.13 -0.12 l
+0.13 -0.11 l
+0.13 -0.12 l
+0.13 -0.11 l
+0.12 -0.11 l
+0.13 -0.12 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.13 -0.12 l
+0.12 -0.11 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.13 -0.12 l
+0.13 -0.11 l
+0.12 -0.11 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.12 -0.11 l
+0.13 -0.11 l
+0.13 -0.10 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.12 -0.11 l
+0.13 -0.10 l
+0.13 -0.11 l
+0.13 -0.11 l
+0.13 -0.10 l
+0.12 -0.11 l
+0.13 -0.11 l
+0.13 -0.10 l
+0.13 -0.11 l
+0.13 -0.10 l
+0.12 -0.11 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.13 -0.11 l
+0.13 -0.10 l
+0.12 -0.10 l
+0.13 -0.10 l
+0.13 -0.11 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.12 -0.10 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.12 -0.10 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.12 -0.10 l
+0.13 -0.10 l
+0.13 -0.09 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.12 -0.09 l
+0.13 -0.10 l
+0.13 -0.10 l
+0.13 -0.09 l
+0.13 -0.10 l
+0.12 -0.09 l
+0.13 -0.10 l
+0.13 -0.09 l
+0.13 -0.10 l
+0.13 -0.09 l
+0.12 -0.10 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.13 -0.10 l
+0.13 -0.09 l
+0.12 -0.09 l
+0.13 -0.09 l
+0.13 -0.10 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.12 -0.09 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.12 -0.09 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.12 -0.09 l
+0.13 -0.09 l
+0.13 -0.08 l
+0.13 -0.09 l
+0.13 -0.09 l
+0.12 -0.09 l
+0.13 -0.08 l
+0.13 -0.09 l
+285.64 365.36 lineto
+0.13 -0.08 l
+0.12 -0.09 l
+0.13 -0.08 l
+0.13 -0.09 l
+0.13 -0.08 l
+0.13 -0.09 l
+0.12 -0.08 l
+0.13 -0.09 l
+0.13 -0.08 l
+0.13 -0.09 l
+0.13 -0.08 l
+0.12 -0.08 l
+0.13 -0.09 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.12 -0.09 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.12 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.12 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.12 -0.08 l
+0.13 -0.08 l
+0.13 -0.07 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.12 -0.08 l
+0.13 -0.07 l
+0.13 -0.08 l
+0.13 -0.08 l
+0.13 -0.07 l
+0.12 -0.08 l
+0.13 -0.08 l
+0.13 -0.07 l
+0.13 -0.08 l
+0.13 -0.07 l
+0.12 -0.08 l
+0.13 -0.07 l
+0.13 -0.08 l
+0.13 -0.07 l
+0.13 -0.08 l
+0.12 -0.07 l
+0.13 -0.07 l
+0.13 -0.08 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.08 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.08 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.07 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.07 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.12 -0.07 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.07 l
+0.12 -0.06 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.12 -0.07 l
+0.13 -0.06 l
+0.13 -0.06 l
+298.44 357.91 lineto
+0.13 -0.06 l
+0.12 -0.07 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.07 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.12 -0.06 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.12 -0.06 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.12 -0.06 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.12 -0.06 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.06 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.06 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.06 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+311.24 352.39 lineto
+0.13 -0.05 l
+0.12 -0.04 l
+0.13 -0.05 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.12 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.12 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.05 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.04 l
+0.13 -0.04 l
+0.13 -0.05 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.04 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.12 -0.04 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.03 l
+324.04 348.30 lineto
+0.13 -0.03 l
+0.12 -0.04 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.04 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.04 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.04 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.04 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+currentpoint o m
+336.84 345.27 lineto
+0.13 -0.02 l
+0.12 -0.03 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.03 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+349.64 343.03 lineto
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+362.44 341.37 lineto
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.02 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.02 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.02 l
+0.13 -0.01 l
+375.24 340.13 lineto
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+388.04 339.22 lineto
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.12 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+0.13 -0.01 l
+0.13 0 l
+0.12 -0.01 l
+0.13 0 l
+0.13 -0.01 l
+400.84 338.54 lineto
+o
+171.64 294.94 423.64 546.94 cl
+0 0 0 srgb
+0.75 setlinewidth
+[] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+208.84 331.66 m
+192.00 0 l
+o
+np
+208.84 331.66 m
+0 -3.60 l
+o
+np
+272.84 331.66 m
+0 -3.60 l
+o
+np
+336.84 331.66 m
+0 -3.60 l
+o
+np
+400.84 331.66 m
+0 -3.60 l
+o
+/Font1 findfont 6 s
+208.84 318.70 (0) .5 0 t
+272.84 318.70 (5) .5 0 t
+336.84 318.70 (10) .5 0 t
+400.84 318.70 (15) .5 0 t
+np
+201.16 336.61 m
+0 173.93 l
+o
+np
+201.16 336.61 m
+-3.60 0 l
+o
+np
+201.16 371.40 m
+-3.60 0 l
+o
+np
+201.16 406.19 m
+-3.60 0 l
+o
+np
+201.16 440.97 m
+-3.60 0 l
+o
+np
+201.16 475.76 m
+-3.60 0 l
+o
+np
+201.16 510.54 m
+-3.60 0 l
+o
+192.52 336.61 (0.0) .5 90 t
+192.52 371.40 (0.2) .5 90 t
+192.52 406.19 (0.4) .5 90 t
+192.52 440.97 (0.6) .5 90 t
+192.52 475.76 (0.8) .5 90 t
+192.52 510.54 (1.0) .5 90 t
+np
+201.16 331.66 m
+207.36 0 l
+0 185.76 l
+-207.36 0 l
+0 -185.76 l
+o
+171.64 294.94 423.64 546.94 cl
+/Font1 findfont 6 s
+0 0 0 srgb
+304.84 304.30 (Cost distance \(in 100\)) .5 0 t
+178.12 383.19 (P) 90 ta
+-0.300 (otential flo) tb
+-0.090 (w betw) tb
+-0.060 (een patches) tb gr
+ep
+%%Trailer
+%%Pages: 1
+%%EOF

Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.eps
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.eps	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.eps	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,3037 @@
+%!PS-Adobe-3.0
+%%DocumentNeededResources: font Helvetica
+%%+ font Helvetica-Bold
+%%+ font Helvetica-Oblique
+%%+ font Helvetica-BoldOblique
+%%+ font Symbol
+%%DocumentMedia: a4 595 841 0 () ()
+%%Title: R Graphics Output
+%%Creator: R Software
+%%Pages: (atend)
+%%Orientation: Portrait
+%%BoundingBox: 172 295 424 547
+%%EndComments
+%%BeginProlog
+/bp  { gs sRGB gs } def
+% begin .ps.prolog
+/gs  { gsave } bind def
+/gr  { grestore } bind def
+/ep  { showpage gr gr } bind def
+/m   { moveto } bind def
+/l  { rlineto } bind def
+/np  { newpath } bind def
+/cp  { closepath } bind def
+/f   { fill } bind def
+/o   { stroke } bind def
+/c   { newpath 0 360 arc } bind def
+/r   { 4 2 roll moveto 1 copy 3 -1 roll exch 0 exch rlineto 0 rlineto -1 mul 0 exch rlineto closepath } bind def
+/p1  { stroke } bind def
+/p2  { gsave bg fill grestore newpath } bind def
+/p3  { gsave bg fill grestore stroke } bind def
+/p6  { gsave bg eofill grestore newpath } bind def
+/p7  { gsave bg eofill grestore stroke } bind def
+/t   { 5 -2 roll moveto gsave rotate
+       1 index stringwidth pop
+       mul neg 0 rmoveto show grestore } bind def
+/ta  { 4 -2 roll moveto gsave rotate show } bind def
+/tb  { 2 -1 roll 0 rmoveto show } bind def
+/cl  { grestore gsave newpath 3 index 3 index moveto 1 index
+       4 -1 roll lineto  exch 1 index lineto lineto
+       closepath clip newpath } bind def
+/rgb { setrgbcolor } bind def
+/s   { scalefont setfont } bind def
+% end   .ps.prolog
+/sRGB { [ /CIEBasedABC
+          << /DecodeLMN
+               [ { dup 0.03928 le
+                        {12.92321 div}
+                        {0.055 add 1.055 div 2.4 exp }
+                     ifelse
+                 } bind dup dup
+               ]
+             /MatrixLMN [0.412457 0.212673 0.019334
+                         0.357576 0.715152 0.119192
+                         0.180437 0.072175 0.950301]
+             /WhitePoint [0.9505 1.0 1.0890]
+           >>
+         ] setcolorspace } bind def
+/srgb { setcolor } bind def
+% begin encoding
+/CP1257Encoding [
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+ /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle
+ /parenleft /parenright /asterisk /plus /comma /minus /period /slash
+ /zero /one /two /three /four /five /six /seven
+ /eight /nine /colon /semicolon /less /equal /greater /question
+ /at /A /B /C /D /E /F /G
+ /H /I /J /K /L /M /N /O
+ /P /Q /R /S /T /U /V /W
+ /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
+ /grave /a /b /c /d /e /f /g
+ /h /i /j /k /l /m /n /o
+ /p /q /r /s /t /u /v /w
+ /x /y /z /braceleft /bar /braceright /asciitilde /.notdef
+ /Euro /.notdef /quotesinglbase /.notdef /quotedblbase /ellipsis /dagger /daggerdbl
+ /.notdef /perthousand /.notdef /guilsinglleft /.notdef /dieresis /caron /cedilla
+ /.notdef /quoteleft /quoteright /quotedblleft /quotedblright /bullet /endash /emdash
+ /.notdef /trademark /.notdef /guilsinglright /.notdef /macron /ogonek /.notdef
+ /space /.notdef /cent /sterling /currency /.notdef /brokenbar /section
+ /Oslash /copyright /Rcommaaccent /guillemotleft /logicalnot /hyphen /registered /AE
+ /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered
+ /oslash /onesuperior /rcommaaccent /guillemotright /onequarter /onehalf /threequarters /ae
+ /Aogonek /Iogonek /Amacron /Cacute /Adieresis /Aring /Eogonek /Emacron
+ /Ccaron /Eacute /Zacute /Edotaccent /Gcommaaccent /Kcommaaccent /Imacron /Lcommaaccent
+ /Scaron /Nacute /Ncommaaccent /Oacute /Omacron /Otilde /Odieresis /multiply
+ /Uogonek /Lslash /Sacute /Umacron /Udieresis /Zdotaccent /Zcaron /germandbls
+ /aogonek /iogonek /amacron /cacute /adieresis /aring /eogonek /emacron
+ /ccaron /eacute /zacute /edotaccent /gcommaaccent /kcommaaccent /imacron /lcommaaccent
+ /scaron /nacute /ncommaaccent /oacute /omacron /otilde /odieresis /divide
+ /uogonek /lslash /sacute /umacron /udieresis /zdotaccent /zcaron /dotaccent
+]
+ def
+% end encoding
+%%IncludeResource: font Helvetica
+/Helvetica findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font1 exch definefont pop
+%%IncludeResource: font Helvetica-Bold
+/Helvetica-Bold findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font2 exch definefont pop
+%%IncludeResource: font Helvetica-Oblique
+/Helvetica-Oblique findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font3 exch definefont pop
+%%IncludeResource: font Helvetica-BoldOblique
+/Helvetica-BoldOblique findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding CP1257Encoding def
+  currentdict
+  end
+/Font4 exch definefont pop
+%%IncludeResource: font Symbol
+/Symbol findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  currentdict
+  end
+/Font5 exch definefont pop
+%%EndProlog
+%%Page: 1 1
+bp
+201.16 331.66 408.52 517.42 cl
+0 0 0 srgb
+0.75 setlinewidth
+[] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+201.16 517.42 m
+0.21 -2.65 l
+0.24 -2.65 l
+0.02 -2.66 l
+0.01 -2.65 l
+0.06 -2.65 l
+0.13 -2.66 l
+0.16 -2.65 l
+0.08 -2.65 l
+0.04 -2.66 l
+0.05 -2.65 l
+0.21 -2.66 l
+0.15 -2.65 l
+0.39 -2.65 l
+0.06 -2.66 l
+0.10 -2.65 l
+0.14 -2.65 l
+0.01 -2.66 l
+0.03 -2.65 l
+0.06 -2.66 l
+0.12 -2.65 l
+0.01 -2.65 l
+0.05 0 l
+0.07 -2.66 l
+0.27 -2.65 l
+0.24 -2.65 l
+0.16 -2.66 l
+0.16 -2.65 l
+0.08 0 l
+0.10 0 l
+0.21 -2.66 l
+0.38 -2.65 l
+0.21 -2.65 l
+0.14 0 l
+0.03 0 l
+0.57 0 l
+0.12 0 l
+0.07 -2.66 l
+0.14 -2.65 l
+0.03 0 l
+0.08 -2.65 l
+0 0 l
+0.15 -2.66 l
+0.01 0 l
+0.01 -2.65 l
+0.10 0 l
+0.01 -2.66 l
+0 0 l
+0.12 -2.65 l
+0.01 -2.65 l
+0.17 -2.66 l
+0.04 0 l
+0.22 0 l
+0.02 0 l
+0.21 0 l
+0.30 0 l
+0.11 0 l
+0 -2.65 l
+0.28 -2.65 l
+0.26 0 l
+0.11 -2.66 l
+0.37 0 l
+0.11 0 l
+0.42 0 l
+0.25 0 l
+0.10 0 l
+0.18 0 l
+0.22 0 l
+0.35 0 l
+0.15 0 l
+0.22 0 l
+0.05 0 l
+0.31 0 l
+0.05 -2.65 l
+0.05 0 l
+0.12 -2.65 l
+0.05 0 l
+0 0 l
+0.04 0 l
+0.06 0 l
+0.04 0 l
+0.07 -2.66 l
+0.04 0 l
+0 0 l
+0.04 0 l
+0.15 0 l
+0.04 0 l
+0.06 -2.65 l
+0.02 0 l
+0.06 0 l
+0.05 -2.66 l
+0.19 0 l
+0.01 0 l
+0.04 0 l
+0.01 0 l
+0 0 l
+0.09 0 l
+0.12 -2.65 l
+0.02 0 l
+0.01 0 l
+212.85 392.70 lineto
+0.06 0 l
+0.21 0 l
+0.21 0 l
+0.06 0 l
+0.09 -2.65 l
+0.03 0 l
+0.04 0 l
+0.01 0 l
+0.05 0 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.06 0 l
+0.05 0 l
+0.01 0 l
+0.05 0 l
+0.03 0 l
+0.06 0 l
+0.01 0 l
+0 0 l
+0.03 0 l
+0.10 0 l
+0.01 0 l
+0.21 0 l
+0.23 -2.66 l
+0.09 0 l
+0.11 0 l
+0.13 0 l
+0.04 0 l
+0.18 0 l
+0.01 0 l
+0.08 0 l
+0.09 0 l
+0.03 0 l
+0 0 l
+0.03 0 l
+0.05 0 l
+0 0 l
+0.09 -2.65 l
+0.04 0 l
+0.10 -2.65 l
+0.35 0 l
+0.07 0 l
+0 0 l
+0.12 0 l
+0.15 0 l
+0.04 -2.66 l
+0 0 l
+0.07 0 l
+0.01 0 l
+0.05 0 l
+0 0 l
+0.19 0 l
+0.01 0 l
+0.10 -2.65 l
+0.28 0 l
+0.02 0 l
+0.10 0 l
+0.03 0 l
+0.05 0 l
+0.08 -2.66 l
+0.05 0 l
+0.06 0 l
+0 0 l
+0.15 0 l
+0.02 0 l
+0.13 0 l
+0.20 0 l
+0.08 0 l
+0.24 0 l
+0.01 0 l
+0.08 0 l
+0.27 0 l
+0.01 0 l
+0.10 0 l
+0.19 0 l
+0 0 l
+0.10 0 l
+0.02 0 l
+0.15 0 l
+0.06 0 l
+0 0 l
+0.05 0 l
+0.05 0 l
+0 0 l
+0.06 0 l
+0.11 0 l
+0 0 l
+0 0 l
+0.27 0 l
+0.06 -2.65 l
+0.05 0 l
+0.02 0 l
+0.09 0 l
+0.14 0 l
+0.14 0 l
+0.03 0 l
+0.07 0 l
+0.08 0 l
+220.74 371.47 lineto
+0.03 0 l
+0.10 0 l
+0.03 0 l
+0.01 0 l
+0.17 0 l
+0.01 0 l
+0.02 0 l
+0.23 0 l
+0.01 0 l
+0.16 0 l
+0.14 0 l
+0.14 0 l
+0.04 0 l
+0 0 l
+0.05 0 l
+0.02 0 l
+0.03 0 l
+0.11 0 l
+0.05 0 l
+0.15 0 l
+0.10 0 l
+0.05 0 l
+0.07 0 l
+0.10 0 l
+0.12 0 l
+0.01 0 l
+0.16 0 l
+0.07 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.20 0 l
+0.06 0 l
+0.09 0 l
+0.05 0 l
+0.03 0 l
+0.01 0 l
+0.04 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.30 0 l
+0.02 0 l
+0.05 0 l
+0.02 0 l
+0.16 0 l
+0.01 0 l
+0.02 0 l
+0.01 0 l
+0.05 0 l
+0.08 0 l
+0.22 0 l
+0.04 0 l
+0.10 0 l
+0.18 0 l
+0.06 0 l
+0.11 0 l
+0.07 0 l
+0 0 l
+0.11 0 l
+0.01 0 l
+0.04 0 l
+0.05 0 l
+0 0 l
+0.17 0 l
+0.21 0 l
+0 0 l
+0.01 0 l
+0.10 0 l
+0.12 0 l
+0.18 0 l
+0.06 0 l
+0.04 0 l
+0.30 0 l
+0.04 0 l
+0.11 0 l
+0.07 0 l
+0.02 0 l
+0.10 0 l
+0.03 0 l
+0.03 0 l
+0.13 0 l
+0.03 0 l
+0.01 0 l
+0.01 -2.65 l
+0.04 0 l
+0.07 0 l
+0.02 0 l
+0.16 0 l
+0.03 0 l
+0.06 0 l
+0.06 0 l
+0 0 l
+0.13 0 l
+0.04 0 l
+0.01 0 l
+0.17 0 l
+0.05 0 l
+0.08 0 l
+228.02 368.82 lineto
+0.14 0 l
+0.01 0 l
+0.03 0 l
+0.13 0 l
+0.02 0 l
+0.13 0 l
+0.02 0 l
+0.02 0 l
+0 0 l
+0.01 0 l
+0.30 0 l
+0.18 0 l
+0.03 0 l
+0.11 0 l
+0.07 0 l
+0.08 0 l
+0 0 l
+0.31 0 l
+0.06 0 l
+0.10 0 l
+0.12 0 l
+0.02 0 l
+0.22 0 l
+0.21 0 l
+0 0 l
+0.12 0 l
+0.08 0 l
+0.01 0 l
+0.03 0 l
+0.02 0 l
+0.06 0 l
+0.06 0 l
+0.09 0 l
+0.02 0 l
+0.08 0 l
+0.08 0 l
+0.30 0 l
+0.04 0 l
+0.01 0 l
+0.08 0 l
+0.03 0 l
+0 0 l
+0.49 0 l
+0.14 0 l
+0.03 0 l
+0.02 0 l
+0.08 0 l
+0.02 0 l
+0.09 0 l
+0.02 0 l
+0.09 0 l
+0.07 0 l
+0.07 -2.66 l
+0.06 0 l
+0.07 0 l
+0.15 0 l
+0.02 0 l
+0.07 -2.65 l
+0.01 0 l
+0 0 l
+0.10 0 l
+0.08 0 l
+0.31 0 l
+0.08 0 l
+0.10 0 l
+0.06 0 l
+0.18 0 l
+0.10 0 l
+0.09 0 l
+0.07 0 l
+0.10 0 l
+0.03 0 l
+0.03 0 l
+0.03 0 l
+0.06 0 l
+0.07 0 l
+0.15 0 l
+0.10 0 l
+0.04 0 l
+0.09 0 l
+0.01 0 l
+0 0 l
+0.05 0 l
+0.02 0 l
+0.14 0 l
+0.24 0 l
+0.01 0 l
+0.03 0 l
+0.17 0 l
+0.16 0 l
+0.10 0 l
+0.07 0 l
+0.01 0 l
+0 0 l
+0.05 0 l
+0.08 0 l
+0.12 0 l
+0.22 0 l
+0.24 0 l
+236.58 363.51 lineto
+0.03 0 l
+0.03 0 l
+0.20 0 l
+0.02 0 l
+0.01 0 l
+0.03 0 l
+0.19 0 l
+0 0 l
+0.02 0 l
+0.03 0 l
+0 0 l
+0.03 0 l
+0.02 0 l
+0.17 0 l
+0 0 l
+0.05 0 l
+0.03 0 l
+0.07 0 l
+0.01 0 l
+0.23 0 l
+0.06 0 l
+0.10 0 l
+0.01 0 l
+0.02 0 l
+0.01 0 l
+0.20 0 l
+0.11 0 l
+0.03 0 l
+0.09 0 l
+0.03 0 l
+0.05 0 l
+0.03 0 l
+0 0 l
+0.10 0 l
+0.06 0 l
+0.02 0 l
+0.05 0 l
+0 0 l
+0.39 0 l
+0.02 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.04 0 l
+0.08 0 l
+0.27 0 l
+0.04 0 l
+0.01 0 l
+0.17 0 l
+0.10 0 l
+0.09 0 l
+0.19 0 l
+0 0 l
+0.05 0 l
+0.20 0 l
+0.02 0 l
+0.21 0 l
+0.10 0 l
+0.06 0 l
+0 0 l
+0.14 0 l
+0.04 0 l
+0.01 0 l
+0.04 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.07 0 l
+0.07 0 l
+0.12 0 l
+0.06 0 l
+0.13 0 l
+0.14 0 l
+0.07 0 l
+0.21 0 l
+0.05 0 l
+0.07 0 l
+0.03 0 l
+0.09 0 l
+0.08 0 l
+0.01 0 l
+0.08 0 l
+0.05 0 l
+0.34 0 l
+0.22 0 l
+0.46 0 l
+0.20 0 l
+0.01 0 l
+0 0 l
+0.12 0 l
+0 0 l
+0.05 0 l
+0.32 0 l
+0.26 0 l
+0.05 0 l
+0.24 0 l
+0.01 0 l
+0.10 0 l
+0.09 0 l
+245.17 363.51 lineto
+0.06 0 l
+0.08 0 l
+0.20 0 l
+0.42 0 l
+0.09 0 l
+0.05 0 l
+0.35 0 l
+0.09 0 l
+0.13 0 l
+0.06 0 l
+0.03 0 l
+0 0 l
+0.09 0 l
+0 0 l
+0.13 0 l
+0.02 0 l
+0.07 0 l
+0.11 0 l
+0.16 0 l
+0.10 0 l
+0.02 0 l
+0.27 0 l
+0.20 0 l
+0.07 0 l
+0.09 0 l
+0.08 0 l
+0.25 0 l
+0.05 0 l
+0.04 0 l
+0.02 0 l
+0.25 0 l
+0.12 0 l
+0.08 0 l
+0.02 0 l
+0.04 0 l
+0.24 0 l
+0.02 0 l
+0.06 0 l
+0.20 0 l
+0.17 0 l
+0.04 0 l
+0.02 0 l
+0.14 0 l
+0.02 0 l
+0.04 0 l
+0.05 0 l
+0.08 0 l
+0.28 0 l
+0.08 0 l
+0.43 0 l
+0.18 0 l
+0.01 0 l
+0.11 0 l
+0.13 0 l
+0.32 0 l
+0.15 0 l
+0 -2.65 l
+0.02 0 l
+0.06 0 l
+0.16 0 l
+0.02 0 l
+0.16 0 l
+0 0 l
+0.06 0 l
+0.01 0 l
+0.32 0 l
+0.12 0 l
+0.22 0 l
+0.17 0 l
+0.03 0 l
+0.02 0 l
+0.71 0 l
+0.05 0 l
+0.01 0 l
+0.02 0 l
+0.12 0 l
+0.09 0 l
+0.38 0 l
+0.05 0 l
+0.16 0 l
+0.25 0 l
+0.19 0 l
+0.08 0 l
+0.03 0 l
+0.11 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.16 0 l
+0.04 0 l
+0.02 0 l
+0.08 0 l
+0.10 0 l
+0.09 0 l
+0.01 0 l
+0.01 0 l
+0.04 0 l
+0.03 0 l
+0.08 0 l
+256.61 358.20 lineto
+0.35 0 l
+0.13 0 l
+0.08 0 l
+0.28 0 l
+0.69 0 l
+0.33 0 l
+0.06 0 l
+0.07 0 l
+0.01 0 l
+0.07 0 l
+0.19 0 l
+0.22 0 l
+0.21 0 l
+0.04 0 l
+0.10 0 l
+0.31 0 l
+0.30 0 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.05 0 l
+0.16 0 l
+0.36 0 l
+0.54 0 l
+0.20 0 l
+0.12 0 l
+0.26 0 l
+0.05 0 l
+0.05 0 l
+0.17 0 l
+0.07 0 l
+0.04 0 l
+0.12 0 l
+0.04 0 l
+0.03 0 l
+0.11 0 l
+0.12 0 l
+0.01 0 l
+0.11 0 l
+0.23 0 l
+0.06 0 l
+0.01 0 l
+0.61 0 l
+0.60 0 l
+0.04 0 l
+0.06 0 l
+0.05 0 l
+0.29 0 l
+0.17 0 l
+0.13 0 l
+0.21 0 l
+8.05 0 l
+0.62 -2.65 l
+2.64 0 l
+0.33 0 l
+1.99 -2.66 l
+4.01 0 l
+4.58 -2.65 l
+0.71 -2.65 l
+2.36 -2.66 l
+7.24 0 l
+0.05 0 l
+1.35 0 l
+2.97 0 l
+0.19 0 l
+0.19 0 l
+3.38 0 l
+0.02 0 l
+4.38 0 l
+1.67 0 l
+1.88 0 l
+0.36 0 l
+0.92 -2.65 l
+15.89 0 l
+0.07 0 l
+1.87 0 l
+0.93 0 l
+4.78 0 l
+21.67 0 l
+1.54 0 l
+34.28 0 l
+12.35 0 l
+o
+171.64 294.94 423.64 546.94 cl
+0 0 0 srgb
+0.75 setlinewidth
+[] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+258.80 331.66 m
+119.47 0 l
+o
+np
+258.80 331.66 m
+0 -3.60 l
+o
+np
+318.54 331.66 m
+0 -3.60 l
+o
+np
+378.27 331.66 m
+0 -3.60 l
+o
+/Font1 findfont 6 s
+258.80 318.70 (5) .5 0 t
+318.54 318.70 (10) .5 0 t
+378.27 318.70 (15) .5 0 t
+np
+201.16 331.66 m
+207.36 0 l
+0 185.76 l
+-207.36 0 l
+0 -185.76 l
+o
+171.64 294.94 423.64 546.94 cl
+/Font1 findfont 6 s
+0 0 0 srgb
+304.84 304.30 (Connectivity threshold) .5 0 t
+250.48 297.10 (\(Cost distance betw) 0 ta
+-0.060 (een patches in 1000\)) tb gr
+201.16 331.66 408.52 517.42 cl
+1 0 0 srgb
+0.75 setlinewidth
+[ 0.00 3.00] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+216.99 331.66 m
+0 185.76 l
+o
+/bg { 1 1 1 srgb } def
+202.19 516.50 192.12 -43.20 r p2
+0 0 0 srgb
+0.75 setlinewidth
+[] 0 setdash
+np
+207.59 509.30 m
+10.80 0 l
+o
+0.75 setlinewidth
+[ 2.25 3.75] 0 setdash
+np
+207.59 502.10 m
+10.80 0 l
+o
+0.75 setlinewidth
+[ 0.00 3.00] 0 setdash
+np
+207.59 494.90 m
+10.80 0 l
+o
+0.75 setlinewidth
+[ 0.00 3.00 2.25 3.00] 0 setdash
+np
+207.59 487.70 m
+10.80 0 l
+o
+1 0 0 srgb
+0.75 setlinewidth
+[ 0.00 3.00] 0 setdash
+np
+207.59 480.50 m
+10.80 0 l
+o
+/Font1 findfont 6 s
+0 0 0 srgb
+223.79 507.14 (Clusters \(in % of maxim) 0 ta
+-0.060 (um possib) tb
+-0.120 (le clusters\)) tb gr
+223.79 499.94 (Siz) 0 ta
+-0.090 (e of the largest cluster \(in % of total population siz) tb
+-0.090 (e\)) tb gr
+223.79 492.74 (Number of edges \(in % of maxim) 0 ta
+-0.060 (um possib) tb
+-0.120 (le n) tb
+-0.060 (umber of edges\)) tb gr
+223.79 485.54 (Diameter \(in % of diameter of the entire g) 0 ta
+-0.060 (r) tb
+-0.060 (aph\)) tb gr
+223.79 478.34 (Connectivity threshold used in analysis) 0 0 t
+171.64 294.94 423.64 546.94 cl
+0 0 0 srgb
+0.75 setlinewidth
+[] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+201.16 331.66 m
+0 185.76 l
+o
+np
+201.16 331.66 m
+-3.60 0 l
+o
+np
+201.16 378.10 m
+-3.60 0 l
+o
+np
+201.16 424.54 m
+-3.60 0 l
+o
+np
+201.16 470.98 m
+-3.60 0 l
+o
+np
+201.16 517.42 m
+-3.60 0 l
+o
+/Font1 findfont 6 s
+192.52 331.66 (0 %) .5 90 t
+192.52 378.10 (25 %) .5 90 t
+192.52 424.54 (50 %) .5 90 t
+192.52 470.98 (75 %) .5 90 t
+192.52 517.42 (100 %) .5 90 t
+201.16 331.66 408.52 517.42 cl
+0 0 0 srgb
+0.75 setlinewidth
+[ 2.25 3.75] 0 setdash
+1 setlinecap
+1 setlinejoin
+10.00 setmiterlimit
+np
+201.16 355.61 m
+0.21 0 l
+0.24 0 l
+0.02 0 l
+0.01 0 l
+0.06 0 l
+0.13 0.67 l
+0.16 0 l
+0.08 0 l
+0.04 0 l
+0.05 0 l
+0.21 0 l
+0.15 0 l
+0.39 0 l
+0.06 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.03 0 l
+0.06 0 l
+0.12 20.24 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.27 0 l
+0.24 12.41 l
+0.16 0 l
+0.16 5.66 l
+0.08 0 l
+0.10 0 l
+0.21 0 l
+0.38 18.48 l
+0.21 0 l
+0.14 0 l
+0.03 0 l
+0.57 0 l
+0.12 0 l
+0.07 0.57 l
+0.14 0 l
+0.03 0 l
+0.08 0 l
+0 0 l
+0.15 2.05 l
+0.01 0 l
+0.01 0 l
+0.10 0 l
+0.01 0 l
+0 0 l
+0.12 1.63 l
+0.01 20.27 l
+0.17 1.95 l
+0.04 0 l
+0.22 0 l
+0.02 0 l
+0.21 0 l
+0.30 0 l
+0.11 0 l
+0 0 l
+0.28 3.80 l
+0.26 0 l
+0.11 0.87 l
+0.37 0 l
+0.11 0 l
+0.42 0 l
+0.25 0 l
+0.10 0 l
+0.18 0 l
+0.22 0 l
+0.35 0 l
+0.15 0 l
+0.22 0 l
+0.05 0 l
+0.31 0 l
+0.05 0 l
+0.05 0 l
+0.12 7.58 l
+0.05 0 l
+0 0 l
+0.04 0 l
+0.06 0 l
+0.04 0 l
+0.07 0.44 l
+0.04 0 l
+0 0 l
+0.04 0 l
+0.15 0 l
+0.04 0 l
+0.06 0 l
+0.02 0 l
+0.06 0 l
+0.05 0 l
+0.19 0 l
+0.01 0 l
+0.04 0 l
+0.01 0 l
+0 0 l
+0.09 0 l
+0.12 8.54 l
+0.02 0 l
+0.01 0 l
+212.85 460.77 lineto
+0.06 0 l
+0.21 0 l
+0.21 0 l
+0.06 0 l
+0.09 0 l
+0.03 0 l
+0.04 0 l
+0.01 0 l
+0.05 0 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.06 0 l
+0.05 0 l
+0.01 0 l
+0.05 0 l
+0.03 0 l
+0.06 0 l
+0.01 0 l
+0 0 l
+0.03 0 l
+0.10 0 l
+0.01 0 l
+0.21 0 l
+0.23 0 l
+0.09 0 l
+0.11 0 l
+0.13 0 l
+0.04 0 l
+0.18 0 l
+0.01 0 l
+0.08 0 l
+0.09 0 l
+0.03 0 l
+0 0 l
+0.03 0 l
+0.05 0 l
+0 0 l
+0.09 28.10 l
+0.04 0 l
+0.10 0 l
+0.35 0 l
+0.07 0 l
+0 0 l
+0.12 0 l
+0.15 0 l
+0.04 1.70 l
+0 0 l
+0.07 0 l
+0.01 0 l
+0.05 0 l
+0 0 l
+0.19 0 l
+0.01 0 l
+0.10 0 l
+0.28 0 l
+0.02 0 l
+0.10 0 l
+0.03 0 l
+0.05 0 l
+0.08 0 l
+0.05 0 l
+0.06 0 l
+0 0 l
+0.15 0 l
+0.02 0 l
+0.13 0 l
+0.20 0 l
+0.08 0 l
+0.24 0 l
+0.01 0 l
+0.08 0 l
+0.27 0 l
+0.01 0 l
+0.10 0 l
+0.19 0 l
+0 0 l
+0.10 0 l
+0.02 0 l
+0.15 0 l
+0.06 0 l
+0 0 l
+0.05 0 l
+0.05 0 l
+0 0 l
+0.06 0 l
+0.11 0 l
+0 0 l
+0 0 l
+0.27 0 l
+0.06 0 l
+0.05 0 l
+0.02 0 l
+0.09 0 l
+0.14 0 l
+0.14 0 l
+0.03 0 l
+0.07 0 l
+0.08 0 l
+220.74 490.57 lineto
+0.03 0 l
+0.10 0 l
+0.03 0 l
+0.01 0 l
+0.17 0 l
+0.01 0 l
+0.02 0 l
+0.23 0 l
+0.01 0 l
+0.16 0 l
+0.14 0 l
+0.14 0 l
+0.04 0 l
+0 0 l
+0.05 0 l
+0.02 0 l
+0.03 0 l
+0.11 0 l
+0.05 0 l
+0.15 0 l
+0.10 0 l
+0.05 0 l
+0.07 0 l
+0.10 0 l
+0.12 0 l
+0.01 0 l
+0.16 0 l
+0.07 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.20 0 l
+0.06 0 l
+0.09 0 l
+0.05 0 l
+0.03 0 l
+0.01 0 l
+0.04 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.30 0 l
+0.02 0 l
+0.05 0 l
+0.02 0 l
+0.16 0 l
+0.01 0 l
+0.02 0 l
+0.01 0 l
+0.05 0 l
+0.08 0 l
+0.22 0 l
+0.04 0 l
+0.10 0 l
+0.18 0 l
+0.06 0 l
+0.11 0 l
+0.07 0 l
+0 0 l
+0.11 0 l
+0.01 0 l
+0.04 0 l
+0.05 0 l
+0 0 l
+0.17 0 l
+0.21 0 l
+0 0 l
+0.01 0 l
+0.10 0 l
+0.12 0 l
+0.18 0 l
+0.06 0 l
+0.04 0 l
+0.30 0 l
+0.04 0 l
+0.11 0 l
+0.07 0 l
+0.02 0 l
+0.10 0 l
+0.03 0 l
+0.03 0 l
+0.13 0 l
+0.03 0 l
+0.01 0 l
+0.01 0 l
+0.04 0 l
+0.07 0 l
+0.02 0 l
+0.16 0 l
+0.03 0 l
+0.06 0 l
+0.06 0 l
+0 0 l
+0.13 0 l
+0.04 0 l
+0.01 0 l
+0.17 0 l
+0.05 0 l
+0.08 0 l
+228.02 490.57 lineto
+0.14 0 l
+0.01 0 l
+0.03 0 l
+0.13 0 l
+0.02 0 l
+0.13 0 l
+0.02 0 l
+0.02 0 l
+0 0 l
+0.01 0 l
+0.30 0 l
+0.18 0 l
+0.03 0 l
+0.11 0 l
+0.07 0 l
+0.08 0 l
+0 0 l
+0.31 0 l
+0.06 0 l
+0.10 0 l
+0.12 0 l
+0.02 0 l
+0.22 0 l
+0.21 0 l
+0 0 l
+0.12 0 l
+0.08 0 l
+0.01 0 l
+0.03 0 l
+0.02 0 l
+0.06 0 l
+0.06 0 l
+0.09 0 l
+0.02 0 l
+0.08 0 l
+0.08 0 l
+0.30 0 l
+0.04 0 l
+0.01 0 l
+0.08 0 l
+0.03 0 l
+0 0 l
+0.49 0 l
+0.14 0 l
+0.03 0 l
+0.02 0 l
+0.08 0 l
+0.02 0 l
+0.09 0 l
+0.02 0 l
+0.09 0 l
+0.07 0 l
+0.07 0 l
+0.06 0 l
+0.07 0 l
+0.15 0 l
+0.02 0 l
+0.07 0 l
+0.01 0 l
+0 0 l
+0.10 0 l
+0.08 0 l
+0.31 0 l
+0.08 0 l
+0.10 0 l
+0.06 0 l
+0.18 0 l
+0.10 0 l
+0.09 0 l
+0.07 0 l
+0.10 0 l
+0.03 0 l
+0.03 0 l
+0.03 0 l
+0.06 0 l
+0.07 0 l
+0.15 0 l
+0.10 0 l
+0.04 0 l
+0.09 0 l
+0.01 0 l
+0 0 l
+0.05 0 l
+0.02 0 l
+0.14 0 l
+0.24 0 l
+0.01 0 l
+0.03 0 l
+0.17 0 l
+0.16 0 l
+0.10 0 l
+0.07 0 l
+0.01 0 l
+0 0 l
+0.05 0 l
+0.08 0 l
+0.12 0 l
+0.22 0 l
+0.24 0 l
+236.58 490.57 lineto
+0.03 0 l
+0.03 0 l
+0.20 0 l
+0.02 0 l
+0.01 0 l
+0.03 0 l
+0.19 0 l
+0 0 l
+0.02 0 l
+0.03 0 l
+0 0 l
+0.03 0 l
+0.02 0 l
+0.17 0 l
+0 0 l
+0.05 0 l
+0.03 0 l
+0.07 0 l
+0.01 0 l
+0.23 0 l
+0.06 0 l
+0.10 0 l
+0.01 0 l
+0.02 0 l
+0.01 0 l
+0.20 0 l
+0.11 0 l
+0.03 0 l
+0.09 0 l
+0.03 0 l
+0.05 0 l
+0.03 0 l
+0 0 l
+0.10 0 l
+0.06 0 l
+0.02 0 l
+0.05 0 l
+0 0 l
+0.39 0 l
+0.02 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.04 0 l
+0.08 0 l
+0.27 0 l
+0.04 0 l
+0.01 0 l
+0.17 0 l
+0.10 0 l
+0.09 0 l
+0.19 0 l
+0 0 l
+0.05 0 l
+0.20 0 l
+0.02 0 l
+0.21 0 l
+0.10 0 l
+0.06 0 l
+0 0 l
+0.14 0 l
+0.04 0 l
+0.01 0 l
+0.04 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.07 0 l
+0.07 0 l
+0.12 0 l
+0.06 0 l
+0.13 0 l
+0.14 0 l
+0.07 0 l
+0.21 0 l
+0.05 0 l
+0.07 0 l
+0.03 0 l
+0.09 0 l
+0.08 0 l
+0.01 0 l
+0.08 0 l
+0.05 0 l
+0.34 0 l
+0.22 0 l
+0.46 0 l
+0.20 0 l
+0.01 0 l
+0 0 l
+0.12 0 l
+0 0 l
+0.05 0 l
+0.32 0 l
+0.26 0 l
+0.05 0 l
+0.24 0 l
+0.01 0 l
+0.10 0 l
+0.09 0 l
+245.17 490.57 lineto
+0.06 0 l
+0.08 0 l
+0.20 0 l
+0.42 0 l
+0.09 0 l
+0.05 0 l
+0.35 0 l
+0.09 0 l
+0.13 0 l
+0.06 0 l
+0.03 0 l
+0 0 l
+0.09 0 l
+0 0 l
+0.13 0 l
+0.02 0 l
+0.07 0 l
+0.11 0 l
+0.16 0 l
+0.10 0 l
+0.02 0 l
+0.27 0 l
+0.20 0 l
+0.07 0 l
+0.09 0 l
+0.08 0 l
+0.25 0 l
+0.05 0 l
+0.04 0 l
+0.02 0 l
+0.25 0 l
+0.12 0 l
+0.08 0 l
+0.02 0 l
+0.04 0 l
+0.24 0 l
+0.02 0 l
+0.06 0 l
+0.20 0 l
+0.17 0 l
+0.04 0 l
+0.02 0 l
+0.14 0 l
+0.02 0 l
+0.04 0 l
+0.05 0 l
+0.08 0 l
+0.28 0 l
+0.08 0 l
+0.43 0 l
+0.18 0 l
+0.01 0 l
+0.11 0 l
+0.13 0 l
+0.32 0 l
+0.15 0 l
+0 4.92 l
+0.02 0 l
+0.06 0 l
+0.16 0 l
+0.02 0 l
+0.16 0 l
+0 0 l
+0.06 0 l
+0.01 0 l
+0.32 0 l
+0.12 0 l
+0.22 0 l
+0.17 0 l
+0.03 0 l
+0.02 0 l
+0.71 0 l
+0.05 0 l
+0.01 0 l
+0.02 0 l
+0.12 0 l
+0.09 0 l
+0.38 0 l
+0.05 0 l
+0.16 0 l
+0.25 0 l
+0.19 0 l
+0.08 0 l
+0.03 0 l
+0.11 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.16 0 l
+0.04 0 l
+0.02 0 l
+0.08 0 l
+0.10 0 l
+0.09 0 l
+0.01 0 l
+0.01 0 l
+0.04 0 l
+0.03 0 l
+0.08 0 l
+256.61 495.49 lineto
+0.35 0 l
+0.13 0 l
+0.08 0 l
+0.28 0 l
+0.69 0 l
+0.33 0 l
+0.06 0 l
+0.07 0 l
+0.01 0 l
+0.07 0 l
+0.19 0 l
+0.22 0 l
+0.21 0 l
+0.04 0 l
+0.10 0 l
+0.31 0 l
+0.30 0 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.05 0 l
+0.16 0 l
+0.36 0 l
+0.54 0 l
+0.20 0 l
+0.12 0 l
+0.26 0 l
+0.05 0 l
+0.05 0 l
+0.17 0 l
+0.07 0 l
+0.04 0 l
+0.12 0 l
+0.04 0 l
+0.03 0 l
+0.11 0 l
+0.12 0 l
+0.01 0 l
+0.11 0 l
+0.23 0 l
+0.06 0 l
+0.01 0 l
+0.61 0 l
+0.60 0 l
+0.04 0 l
+0.06 0 l
+0.05 0 l
+0.29 0 l
+0.17 0 l
+0.13 0 l
+0.21 0 l
+8.05 0 l
+0.62 0.58 l
+2.64 0 l
+0.33 0 l
+1.99 0 l
+4.01 0 l
+4.58 0 l
+0.71 3.03 l
+2.36 0 l
+7.24 0 l
+0.05 0 l
+1.35 0 l
+2.97 0 l
+0.19 0 l
+0.19 0 l
+3.38 0 l
+0.02 0 l
+4.38 0 l
+1.67 0 l
+1.88 0 l
+0.36 0 l
+0.92 7.20 l
+15.89 0 l
+0.07 0 l
+1.87 0 l
+0.93 0 l
+4.78 0 l
+21.67 0 l
+1.54 0 l
+34.28 0 l
+12.35 0 l
+o
+0.75 setlinewidth
+[ 0.00 3.00] 0 setdash
+np
+201.16 331.94 m
+0.21 0.27 l
+0.24 0.27 l
+0.02 0.27 l
+0.01 0.27 l
+0.06 0.28 l
+0.13 0.27 l
+0.16 0.27 l
+0.08 0.27 l
+0.04 0.27 l
+0.05 0.28 l
+0.21 0.27 l
+0.15 0.27 l
+0.39 0.27 l
+0.06 0.27 l
+0.10 0.28 l
+0.14 0.27 l
+0.01 0.27 l
+0.03 0.27 l
+0.06 0.27 l
+0.12 0.28 l
+0.01 0.27 l
+0.05 0.27 l
+0.07 0.27 l
+0.27 0.27 l
+0.24 0.28 l
+0.16 0.27 l
+0.16 0.27 l
+0.08 0.27 l
+0.10 0.27 l
+0.21 0.28 l
+0.38 0.27 l
+0.21 0.27 l
+0.14 0.27 l
+0.03 0.27 l
+0.57 0.28 l
+0.12 0.27 l
+0.07 0.27 l
+0.14 0.27 l
+0.03 0.27 l
+0.08 0.28 l
+0 0.27 l
+0.15 0.27 l
+0.01 0.27 l
+0.01 0.27 l
+0.10 0.28 l
+0.01 0.27 l
+0 0.27 l
+0.12 0.27 l
+0.01 0.27 l
+0.17 0.28 l
+0.04 0.27 l
+0.22 0.27 l
+0.02 0.27 l
+0.21 0.27 l
+0.30 0.28 l
+0.11 0.27 l
+0 0.27 l
+0.28 0.27 l
+0.26 0.27 l
+0.11 0.28 l
+0.37 0.27 l
+0.11 0.27 l
+0.42 0.27 l
+0.25 0.27 l
+0.10 0.28 l
+0.18 0.27 l
+0.22 0.27 l
+0.35 0.27 l
+0.15 0.27 l
+0.22 0.28 l
+0.05 0.27 l
+0.31 0.27 l
+0.05 0.27 l
+0.05 0.27 l
+0.12 0.28 l
+0.05 0.27 l
+0 0.27 l
+0.04 0.27 l
+0.06 0.27 l
+0.04 0.27 l
+0.07 0.28 l
+0.04 0.27 l
+0 0.27 l
+0.04 0.27 l
+0.15 0.27 l
+0.04 0.28 l
+0.06 0.27 l
+0.02 0.27 l
+0.06 0.27 l
+0.05 0.27 l
+0.19 0.28 l
+0.01 0.27 l
+0.04 0.27 l
+0.01 0.27 l
+0 0.27 l
+0.09 0.28 l
+0.12 0.27 l
+0.02 0.27 l
+0.01 0.27 l
+212.85 359.13 lineto
+0.06 0.28 l
+0.21 0.27 l
+0.21 0.27 l
+0.06 0.27 l
+0.09 0.27 l
+0.03 0.28 l
+0.04 0.27 l
+0.01 0.27 l
+0.05 0.27 l
+0.01 0.27 l
+0.05 0.28 l
+0.07 0.27 l
+0.06 0.27 l
+0.05 0.27 l
+0.01 0.27 l
+0.05 0.28 l
+0.03 0.27 l
+0.06 0.27 l
+0.01 0.27 l
+0 0.27 l
+0.03 0.28 l
+0.10 0.27 l
+0.01 0.27 l
+0.21 0.27 l
+0.23 0.27 l
+0.09 0.28 l
+0.11 0.27 l
+0.13 0.27 l
+0.04 0.27 l
+0.18 0.27 l
+0.01 0.28 l
+0.08 0.27 l
+0.09 0.27 l
+0.03 0.27 l
+0 0.27 l
+0.03 0.28 l
+0.05 0.27 l
+0 0.27 l
+0.09 0.27 l
+0.04 0.27 l
+0.10 0.28 l
+0.35 0.27 l
+0.07 0.27 l
+0 0.27 l
+0.12 0.27 l
+0.15 0.28 l
+0.04 0.27 l
+0 0.27 l
+0.07 0.27 l
+0.01 0.27 l
+0.05 0.28 l
+0 0.27 l
+0.19 0.27 l
+0.01 0.27 l
+0.10 0.27 l
+0.28 0.28 l
+0.02 0.27 l
+0.10 0.27 l
+0.03 0.27 l
+0.05 0.27 l
+0.08 0.28 l
+0.05 0.27 l
+0.06 0.27 l
+0 0.27 l
+0.15 0.27 l
+0.02 0.27 l
+0.13 0.28 l
+0.20 0.27 l
+0.08 0.27 l
+0.24 0.27 l
+0.01 0.27 l
+0.08 0.28 l
+0.27 0.27 l
+0.01 0.27 l
+0.10 0.27 l
+0.19 0.27 l
+0 0.28 l
+0.10 0.27 l
+0.02 0.27 l
+0.15 0.27 l
+0.06 0.27 l
+0 0.28 l
+0.05 0.27 l
+0.05 0.27 l
+0 0.27 l
+0.06 0.27 l
+0.11 0.28 l
+0 0.27 l
+0 0.27 l
+0.27 0.27 l
+0.06 0.27 l
+0.05 0.28 l
+0.02 0.27 l
+0.09 0.27 l
+0.14 0.27 l
+0.14 0.27 l
+0.03 0.28 l
+0.07 0.27 l
+0.08 0.27 l
+220.74 386.33 lineto
+0.03 0.27 l
+0.10 0.28 l
+0.03 0.27 l
+0.01 0.27 l
+0.17 0.27 l
+0.01 0.27 l
+0.02 0.28 l
+0.23 0.27 l
+0.01 0.27 l
+0.16 0.27 l
+0.14 0.27 l
+0.14 0.28 l
+0.04 0.27 l
+0 0.27 l
+0.05 0.27 l
+0.02 0.27 l
+0.03 0.28 l
+0.11 0.27 l
+0.05 0.27 l
+0.15 0.27 l
+0.10 0.27 l
+0.05 0.28 l
+0.07 0.27 l
+0.10 0.27 l
+0.12 0.27 l
+0.01 0.27 l
+0.16 0.28 l
+0.07 0.27 l
+0.01 0.27 l
+0.02 0.27 l
+0.03 0.27 l
+0.20 0.28 l
+0.06 0.27 l
+0.09 0.27 l
+0.05 0.27 l
+0.03 0.27 l
+0.01 0.28 l
+0.04 0.27 l
+0.01 0.27 l
+0.02 0.27 l
+0.03 0.27 l
+0.30 0.28 l
+0.02 0.27 l
+0.05 0.27 l
+0.02 0.27 l
+0.16 0.27 l
+0.01 0.28 l
+0.02 0.27 l
+0.01 0.27 l
+0.05 0.27 l
+0.08 0.27 l
+0.22 0.27 l
+0.04 0.28 l
+0.10 0.27 l
+0.18 0.27 l
+0.06 0.27 l
+0.11 0.27 l
+0.07 0.28 l
+0 0.27 l
+0.11 0.27 l
+0.01 0.27 l
+0.04 0.27 l
+0.05 0.28 l
+0 0.27 l
+0.17 0.27 l
+0.21 0.27 l
+0 0.27 l
+0.01 0.28 l
+0.10 0.27 l
+0.12 0.27 l
+0.18 0.27 l
+0.06 0.27 l
+0.04 0.28 l
+0.30 0.27 l
+0.04 0.27 l
+0.11 0.27 l
+0.07 0.27 l
+0.02 0.28 l
+0.10 0.27 l
+0.03 0.27 l
+0.03 0.27 l
+0.13 0.27 l
+0.03 0.28 l
+0.01 0.27 l
+0.01 0.27 l
+0.04 0.27 l
+0.07 0.27 l
+0.02 0.28 l
+0.16 0.27 l
+0.03 0.27 l
+0.06 0.27 l
+0.06 0.27 l
+0 0.28 l
+0.13 0.27 l
+0.04 0.27 l
+0.01 0.27 l
+0.17 0.27 l
+0.05 0.28 l
+0.08 0.27 l
+228.02 413.53 lineto
+0.14 0.27 l
+0.01 0.27 l
+0.03 0.28 l
+0.13 0.27 l
+0.02 0.27 l
+0.13 0.27 l
+0.02 0.27 l
+0.02 0.28 l
+0 0.27 l
+0.01 0.27 l
+0.30 0.27 l
+0.18 0.27 l
+0.03 0.28 l
+0.11 0.27 l
+0.07 0.27 l
+0.08 0.27 l
+0 0.27 l
+0.31 0.28 l
+0.06 0.27 l
+0.10 0.27 l
+0.12 0.27 l
+0.02 0.27 l
+0.22 0.28 l
+0.21 0.27 l
+0 0.27 l
+0.12 0.27 l
+0.08 0.27 l
+0.01 0.28 l
+0.03 0.27 l
+0.02 0.27 l
+0.06 0.27 l
+0.06 0.27 l
+0.09 0.28 l
+0.02 0.27 l
+0.08 0.27 l
+0.08 0.27 l
+0.30 0.27 l
+0.04 0.27 l
+0.01 0.28 l
+0.08 0.27 l
+0.03 0.27 l
+0 0.27 l
+0.49 0.27 l
+0.14 0.28 l
+0.03 0.27 l
+0.02 0.27 l
+0.08 0.27 l
+0.02 0.27 l
+0.09 0.28 l
+0.02 0.27 l
+0.09 0.27 l
+0.07 0.27 l
+0.07 0.27 l
+0.06 0.28 l
+0.07 0.27 l
+0.15 0.27 l
+0.02 0.27 l
+0.07 0.27 l
+0.01 0.28 l
+0 0.27 l
+0.10 0.27 l
+0.08 0.27 l
+0.31 0.27 l
+0.08 0.28 l
+0.10 0.27 l
+0.06 0.27 l
+0.18 0.27 l
+0.10 0.27 l
+0.09 0.28 l
+0.07 0.27 l
+0.10 0.27 l
+0.03 0.27 l
+0.03 0.27 l
+0.03 0.28 l
+0.06 0.27 l
+0.07 0.27 l
+0.15 0.27 l
+0.10 0.27 l
+0.04 0.28 l
+0.09 0.27 l
+0.01 0.27 l
+0 0.27 l
+0.05 0.27 l
+0.02 0.28 l
+0.14 0.27 l
+0.24 0.27 l
+0.01 0.27 l
+0.03 0.27 l
+0.17 0.28 l
+0.16 0.27 l
+0.10 0.27 l
+0.07 0.27 l
+0.01 0.27 l
+0 0.28 l
+0.05 0.27 l
+0.08 0.27 l
+0.12 0.27 l
+0.22 0.27 l
+0.24 0.28 l
+236.58 440.73 lineto
+0.03 0.27 l
+0.03 0.27 l
+0.20 0.27 l
+0.02 0.28 l
+0.01 0.27 l
+0.03 0.27 l
+0.19 0.27 l
+0 0.27 l
+0.02 0.28 l
+0.03 0.27 l
+0 0.27 l
+0.03 0.27 l
+0.02 0.27 l
+0.17 0.28 l
+0 0.27 l
+0.05 0.27 l
+0.03 0.27 l
+0.07 0.27 l
+0.01 0.28 l
+0.23 0.27 l
+0.06 0.27 l
+0.10 0.27 l
+0.01 0.27 l
+0.02 0.27 l
+0.01 0.28 l
+0.20 0.27 l
+0.11 0.27 l
+0.03 0.27 l
+0.09 0.27 l
+0.03 0.28 l
+0.05 0.27 l
+0.03 0.27 l
+0 0.27 l
+0.10 0.27 l
+0.06 0.28 l
+0.02 0.27 l
+0.05 0.27 l
+0 0.27 l
+0.39 0.27 l
+0.02 0.28 l
+0.01 0.27 l
+0.02 0.27 l
+0.03 0.27 l
+0.04 0.27 l
+0.08 0.28 l
+0.27 0.27 l
+0.04 0.27 l
+0.01 0.27 l
+0.17 0.27 l
+0.10 0.28 l
+0.09 0.27 l
+0.19 0.27 l
+0 0.27 l
+0.05 0.27 l
+0.20 0.28 l
+0.02 0.27 l
+0.21 0.27 l
+0.10 0.27 l
+0.06 0.27 l
+0 0.28 l
+0.14 0.27 l
+0.04 0.27 l
+0.01 0.27 l
+0.04 0.27 l
+0.10 0.28 l
+0.14 0.27 l
+0.01 0.27 l
+0.07 0.27 l
+0.07 0.27 l
+0.12 0.28 l
+0.06 0.27 l
+0.13 0.27 l
+0.14 0.27 l
+0.07 0.27 l
+0.21 0.28 l
+0.05 0.27 l
+0.07 0.27 l
+0.03 0.27 l
+0.09 0.27 l
+0.08 0.28 l
+0.01 0.27 l
+0.08 0.27 l
+0.05 0.27 l
+0.34 0.27 l
+0.22 0.28 l
+0.46 0.27 l
+0.20 0.27 l
+0.01 0.27 l
+0 0.27 l
+0.12 0.28 l
+0 0.27 l
+0.05 0.27 l
+0.32 0.27 l
+0.26 0.27 l
+0.05 0.28 l
+0.24 0.27 l
+0.01 0.27 l
+0.10 0.27 l
+0.09 0.27 l
+245.17 467.93 lineto
+0.06 0.27 l
+0.08 0.27 l
+0.20 0.27 l
+0.42 0.27 l
+0.09 0.28 l
+0.05 0.27 l
+0.35 0.27 l
+0.09 0.27 l
+0.13 0.27 l
+0.06 0.27 l
+0.03 0.28 l
+0 0.27 l
+0.09 0.27 l
+0 0.27 l
+0.13 0.27 l
+0.02 0.28 l
+0.07 0.27 l
+0.11 0.27 l
+0.16 0.27 l
+0.10 0.27 l
+0.02 0.28 l
+0.27 0.27 l
+0.20 0.27 l
+0.07 0.27 l
+0.09 0.27 l
+0.08 0.28 l
+0.25 0.27 l
+0.05 0.27 l
+0.04 0.27 l
+0.02 0.27 l
+0.25 0.28 l
+0.12 0.27 l
+0.08 0.27 l
+0.02 0.27 l
+0.04 0.27 l
+0.24 0.28 l
+0.02 0.27 l
+0.06 0.27 l
+0.20 0.27 l
+0.17 0.27 l
+0.04 0.28 l
+0.02 0.27 l
+0.14 0.27 l
+0.02 0.27 l
+0.04 0.27 l
+0.05 0.28 l
+0.08 0.27 l
+0.28 0.27 l
+0.08 0.27 l
+0.43 0.27 l
+0.18 0.28 l
+0.01 0.27 l
+0.11 0.27 l
+0.13 0.27 l
+0.32 0.27 l
+0.15 0.28 l
+0 0.27 l
+0.02 0.27 l
+0.06 0.27 l
+0.16 0.27 l
+0.02 0.28 l
+0.16 0.27 l
+0 0.27 l
+0.06 0.27 l
+0.01 0.27 l
+0.32 0.28 l
+0.12 0.27 l
+0.22 0.27 l
+0.17 0.27 l
+0.03 0.27 l
+0.02 0.28 l
+0.71 0.27 l
+0.05 0.27 l
+0.01 0.27 l
+0.02 0.27 l
+0.12 0.28 l
+0.09 0.27 l
+0.38 0.27 l
+0.05 0.27 l
+0.16 0.27 l
+0.25 0.28 l
+0.19 0.27 l
+0.08 0.27 l
+0.03 0.27 l
+0.11 0.27 l
+0.10 0.28 l
+0.14 0.27 l
+0.01 0.27 l
+0.16 0.27 l
+0.04 0.27 l
+0.02 0.28 l
+0.08 0.27 l
+0.10 0.27 l
+0.09 0.27 l
+0.01 0.27 l
+0.01 0.27 l
+0.04 0.28 l
+0.03 0.27 l
+0.08 0.27 l
+256.61 495.12 lineto
+0.35 0.27 l
+0.13 0.28 l
+0.08 0.27 l
+0.28 0.27 l
+0.69 0.27 l
+0.33 0.27 l
+0.06 0.28 l
+0.07 0.27 l
+0.01 0.27 l
+0.07 0.27 l
+0.19 0.27 l
+0.22 0.28 l
+0.21 0.27 l
+0.04 0.27 l
+0.10 0.27 l
+0.31 0.27 l
+0.30 0.28 l
+0.01 0.27 l
+0.05 0.27 l
+0.07 0.27 l
+0.05 0.27 l
+0.16 0.28 l
+0.36 0.27 l
+0.54 0.27 l
+0.20 0.27 l
+0.12 0.27 l
+0.26 0.28 l
+0.05 0.27 l
+0.05 0.27 l
+0.17 0.27 l
+0.07 0.27 l
+0.04 0.28 l
+0.12 0.27 l
+0.04 0.27 l
+0.03 0.27 l
+0.11 0.27 l
+0.12 0.28 l
+0.01 0.27 l
+0.11 0.27 l
+0.23 0.27 l
+0.06 0.27 l
+0.01 0.28 l
+0.61 0.27 l
+0.60 0.27 l
+0.04 0.27 l
+0.06 0.27 l
+0.05 0.28 l
+0.29 0.27 l
+0.17 0.27 l
+0.13 0.27 l
+0.21 0.27 l
+8.05 0.28 l
+0.62 0.27 l
+2.64 0.27 l
+0.33 0.27 l
+1.99 0.27 l
+4.01 0.28 l
+4.58 0.27 l
+0.71 0.27 l
+2.36 0.27 l
+7.24 0.27 l
+0.05 0.28 l
+1.35 0.27 l
+2.97 0.27 l
+0.19 0.27 l
+0.19 0.27 l
+3.38 0.28 l
+0.02 0.27 l
+4.38 0.27 l
+1.67 0.27 l
+1.88 0.27 l
+0.36 0.28 l
+0.92 0.27 l
+15.89 0.27 l
+0.07 0.27 l
+1.87 0.27 l
+0.93 0.27 l
+4.78 0.28 l
+21.67 0.27 l
+1.54 0.27 l
+34.28 0.27 l
+12.35 0.27 l
+o
+0.75 setlinewidth
+[ 0.00 3.00 2.25 3.00] 0 setdash
+np
+201.16 331.66 m
+0.21 0.65 l
+0.24 0.71 l
+0.02 0 l
+0.01 0.79 l
+0.06 0 l
+0.13 0 l
+0.16 0 l
+0.08 0 l
+0.04 0 l
+0.05 0 l
+0.21 0 l
+0.15 0 l
+0.39 0.71 l
+0.06 0 l
+0.10 0 l
+0.14 0.38 l
+0.01 0 l
+0.03 0 l
+0.06 1.29 l
+0.12 2.99 l
+0.01 0 l
+0.05 -0.81 l
+0.07 0 l
+0.27 0 l
+0.24 1.47 l
+0.16 0 l
+0.16 1.20 l
+0.08 0 l
+0.10 -0.34 l
+0.21 0 l
+0.38 3.05 l
+0.21 0 l
+0.14 0 l
+0.03 0 l
+0.57 0 l
+0.12 0 l
+0.07 0 l
+0.14 0 l
+0.03 -0.77 l
+0.08 0 l
+0 0 l
+0.15 1.34 l
+0.01 0 l
+0.01 0 l
+0.10 0 l
+0.01 0 l
+0 0 l
+0.12 1.10 l
+0.01 3.47 l
+0.17 0 l
+0.04 0 l
+0.22 0 l
+0.02 0 l
+0.21 0 l
+0.30 0 l
+0.11 0 l
+0 0 l
+0.28 3.40 l
+0.26 0 l
+0.11 0 l
+0.37 0 l
+0.11 0 l
+0.42 0 l
+0.25 0 l
+0.10 0 l
+0.18 0 l
+0.22 0 l
+0.35 0 l
+0.15 -4.58 l
+0.22 0 l
+0.05 0 l
+0.31 0 l
+0.05 0 l
+0.05 0 l
+0.12 5.14 l
+0.05 0 l
+0 0 l
+0.04 0 l
+0.06 0 l
+0.04 0 l
+0.07 3.42 l
+0.04 0 l
+0 0 l
+0.04 0 l
+0.15 0 l
+0.04 0 l
+0.06 0 l
+0.02 0 l
+0.06 0 l
+0.05 0 l
+0.19 0 l
+0.01 0 l
+0.04 0 l
+0.01 0 l
+0 -1.64 l
+0.09 0 l
+0.12 9.57 l
+0.02 0 l
+0.01 0 l
+212.85 364.20 lineto
+0.06 0 l
+0.21 0 l
+0.21 0 l
+0.06 0 l
+0.09 0 l
+0.03 0 l
+0.04 0 l
+0.01 0 l
+0.05 0 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.06 0 l
+0.05 0 l
+0.01 0 l
+0.05 0 l
+0.03 0 l
+0.06 0 l
+0.01 0 l
+0 0 l
+0.03 0 l
+0.10 0 l
+0.01 0 l
+0.21 0 l
+0.23 0 l
+0.09 0 l
+0.11 0 l
+0.13 0 l
+0.04 0 l
+0.18 0 l
+0.01 0 l
+0.08 0 l
+0.09 0 l
+0.03 0 l
+0 0 l
+0.03 0 l
+0.05 0 l
+0 0 l
+0.09 8.87 l
+0.04 0 l
+0.10 0 l
+0.35 0 l
+0.07 0 l
+0 0 l
+0.12 0 l
+0.15 0 l
+0.04 0 l
+0 -0.96 l
+0.07 0 l
+0.01 0 l
+0.05 0 l
+0 0 l
+0.19 0 l
+0.01 0 l
+0.10 0 l
+0.28 -0.05 l
+0.02 0 l
+0.10 0 l
+0.03 0 l
+0.05 0 l
+0.08 0 l
+0.05 0 l
+0.06 0 l
+0 0 l
+0.15 0 l
+0.02 0 l
+0.13 0 l
+0.20 0 l
+0.08 0 l
+0.24 0 l
+0.01 0 l
+0.08 0 l
+0.27 0 l
+0.01 0 l
+0.10 0 l
+0.19 0 l
+0 0 l
+0.10 0 l
+0.02 0 l
+0.15 0 l
+0.06 0 l
+0 0 l
+0.05 0 l
+0.05 0 l
+0 0 l
+0.06 0 l
+0.11 0 l
+0 0 l
+0 0 l
+0.27 0 l
+0.06 0 l
+0.05 0 l
+0.02 0 l
+0.09 0 l
+0.14 0 l
+0.14 0 l
+0.03 0 l
+0.07 0 l
+0.08 0 l
+220.74 372.06 lineto
+0.03 0 l
+0.10 0 l
+0.03 0 l
+0.01 0 l
+0.17 0 l
+0.01 0 l
+0.02 0 l
+0.23 0 l
+0.01 0 l
+0.16 0 l
+0.14 0 l
+0.14 0 l
+0.04 0 l
+0 0 l
+0.05 0 l
+0.02 0 l
+0.03 -0.17 l
+0.11 0 l
+0.05 0 l
+0.15 0 l
+0.10 0 l
+0.05 0 l
+0.07 0 l
+0.10 0 l
+0.12 0 l
+0.01 0 l
+0.16 -0.01 l
+0.07 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.20 0 l
+0.06 0 l
+0.09 0 l
+0.05 0 l
+0.03 0 l
+0.01 0 l
+0.04 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.30 0 l
+0.02 0 l
+0.05 0 l
+0.02 0 l
+0.16 0 l
+0.01 -0.03 l
+0.02 0 l
+0.01 0 l
+0.05 0 l
+0.08 0 l
+0.22 0 l
+0.04 0 l
+0.10 0 l
+0.18 0 l
+0.06 0 l
+0.11 0 l
+0.07 0 l
+0 0 l
+0.11 0 l
+0.01 0 l
+0.04 0 l
+0.05 0 l
+0 0 l
+0.17 0 l
+0.21 0 l
+0 0 l
+0.01 0 l
+0.10 0 l
+0.12 0 l
+0.18 0 l
+0.06 0 l
+0.04 0 l
+0.30 0 l
+0.04 0 l
+0.11 0 l
+0.07 0 l
+0.02 0 l
+0.10 0 l
+0.03 0 l
+0.03 0 l
+0.13 0 l
+0.03 0 l
+0.01 0 l
+0.01 0 l
+0.04 0 l
+0.07 0 l
+0.02 0 l
+0.16 0 l
+0.03 0 l
+0.06 0 l
+0.06 0 l
+0 0 l
+0.13 0 l
+0.04 0 l
+0.01 0 l
+0.17 0 l
+0.05 0 l
+0.08 0 l
+228.02 371.85 lineto
+0.14 0 l
+0.01 0 l
+0.03 0 l
+0.13 0 l
+0.02 0 l
+0.13 0 l
+0.02 0 l
+0.02 0 l
+0 0 l
+0.01 0 l
+0.30 0 l
+0.18 0 l
+0.03 0 l
+0.11 0 l
+0.07 0 l
+0.08 0 l
+0 0 l
+0.31 0 l
+0.06 0 l
+0.10 0 l
+0.12 0 l
+0.02 0 l
+0.22 0 l
+0.21 0 l
+0 0 l
+0.12 0 l
+0.08 0 l
+0.01 0 l
+0.03 0 l
+0.02 0 l
+0.06 0 l
+0.06 0 l
+0.09 0 l
+0.02 0 l
+0.08 0 l
+0.08 0 l
+0.30 0 l
+0.04 0 l
+0.01 0 l
+0.08 0 l
+0.03 0 l
+0 0 l
+0.49 0 l
+0.14 0 l
+0.03 0 l
+0.02 0 l
+0.08 0 l
+0.02 0 l
+0.09 0 l
+0.02 0 l
+0.09 0 l
+0.07 0 l
+0.07 0 l
+0.06 0 l
+0.07 0 l
+0.15 0 l
+0.02 0 l
+0.07 0 l
+0.01 0 l
+0 0 l
+0.10 0 l
+0.08 0 l
+0.31 0 l
+0.08 0 l
+0.10 0 l
+0.06 0 l
+0.18 0 l
+0.10 0 l
+0.09 0 l
+0.07 0 l
+0.10 0 l
+0.03 0 l
+0.03 0 l
+0.03 0 l
+0.06 0 l
+0.07 0 l
+0.15 0 l
+0.10 0 l
+0.04 0 l
+0.09 0 l
+0.01 0 l
+0 0 l
+0.05 0 l
+0.02 0 l
+0.14 0 l
+0.24 0 l
+0.01 0 l
+0.03 0 l
+0.17 0 l
+0.16 0 l
+0.10 0 l
+0.07 0 l
+0.01 0 l
+0 0 l
+0.05 0 l
+0.08 0 l
+0.12 0 l
+0.22 0 l
+0.24 0 l
+236.58 371.85 lineto
+0.03 0 l
+0.03 0 l
+0.20 0 l
+0.02 0 l
+0.01 0 l
+0.03 0 l
+0.19 0 l
+0 0 l
+0.02 0 l
+0.03 0 l
+0 0 l
+0.03 0 l
+0.02 0 l
+0.17 0 l
+0 0 l
+0.05 0 l
+0.03 0 l
+0.07 0 l
+0.01 0 l
+0.23 0 l
+0.06 0 l
+0.10 0 l
+0.01 0 l
+0.02 0 l
+0.01 0 l
+0.20 0 l
+0.11 0 l
+0.03 0 l
+0.09 0 l
+0.03 0 l
+0.05 0 l
+0.03 0 l
+0 0 l
+0.10 0 l
+0.06 0 l
+0.02 0 l
+0.05 0 l
+0 0 l
+0.39 0 l
+0.02 0 l
+0.01 0 l
+0.02 0 l
+0.03 0 l
+0.04 0 l
+0.08 0 l
+0.27 0 l
+0.04 0 l
+0.01 0 l
+0.17 0 l
+0.10 0 l
+0.09 0 l
+0.19 0 l
+0 0 l
+0.05 0 l
+0.20 0 l
+0.02 0 l
+0.21 0 l
+0.10 0 l
+0.06 0 l
+0 0 l
+0.14 0 l
+0.04 0 l
+0.01 0 l
+0.04 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.07 0 l
+0.07 0 l
+0.12 0 l
+0.06 0 l
+0.13 0 l
+0.14 0 l
+0.07 0 l
+0.21 0 l
+0.05 0 l
+0.07 0 l
+0.03 0 l
+0.09 0 l
+0.08 0 l
+0.01 0 l
+0.08 0 l
+0.05 0 l
+0.34 0 l
+0.22 0 l
+0.46 0 l
+0.20 0 l
+0.01 0 l
+0 0 l
+0.12 0 l
+0 0 l
+0.05 0 l
+0.32 0 l
+0.26 0 l
+0.05 0 l
+0.24 0 l
+0.01 0 l
+0.10 0 l
+0.09 0 l
+245.17 371.85 lineto
+0.06 0 l
+0.08 0 l
+0.20 0 l
+0.42 0 l
+0.09 0 l
+0.05 0 l
+0.35 0 l
+0.09 0 l
+0.13 0 l
+0.06 0 l
+0.03 0 l
+0 0 l
+0.09 0 l
+0 0 l
+0.13 0 l
+0.02 0 l
+0.07 0 l
+0.11 0 l
+0.16 0 l
+0.10 0 l
+0.02 0 l
+0.27 0 l
+0.20 0 l
+0.07 0 l
+0.09 0 l
+0.08 0 l
+0.25 0 l
+0.05 0 l
+0.04 0 l
+0.02 0 l
+0.25 0 l
+0.12 0 l
+0.08 0 l
+0.02 0 l
+0.04 0 l
+0.24 0 l
+0.02 0 l
+0.06 0 l
+0.20 0 l
+0.17 0 l
+0.04 0 l
+0.02 0 l
+0.14 0 l
+0.02 0 l
+0.04 0 l
+0.05 0 l
+0.08 0 l
+0.28 0 l
+0.08 0 l
+0.43 0 l
+0.18 0 l
+0.01 0 l
+0.11 0 l
+0.13 0 l
+0.32 0 l
+0.15 0 l
+0 37.52 l
+0.02 -0.02 l
+0.06 0 l
+0.16 0 l
+0.02 0 l
+0.16 0 l
+0 0 l
+0.06 0 l
+0.01 0 l
+0.32 0 l
+0.12 0 l
+0.22 0 l
+0.17 0 l
+0.03 0 l
+0.02 0 l
+0.71 0 l
+0.05 0 l
+0.01 0 l
+0.02 0 l
+0.12 0 l
+0.09 0 l
+0.38 0 l
+0.05 0 l
+0.16 0 l
+0.25 0 l
+0.19 0 l
+0.08 0 l
+0.03 0 l
+0.11 0 l
+0.10 0 l
+0.14 0 l
+0.01 0 l
+0.16 0 l
+0.04 0 l
+0.02 0 l
+0.08 0 l
+0.10 0 l
+0.09 0 l
+0.01 0 l
+0.01 0 l
+0.04 0 l
+0.03 0 l
+0.08 0 l
+256.61 409.35 lineto
+0.35 0 l
+0.13 0 l
+0.08 0 l
+0.28 0 l
+0.69 0 l
+0.33 0 l
+0.06 0 l
+0.07 0 l
+0.01 0 l
+0.07 0 l
+0.19 0 l
+0.22 0 l
+0.21 0 l
+0.04 0 l
+0.10 0 l
+0.31 0 l
+0.30 0 l
+0.01 0 l
+0.05 0 l
+0.07 0 l
+0.05 0 l
+0.16 0 l
+0.36 0 l
+0.54 0 l
+0.20 0 l
+0.12 0 l
+0.26 0 l
+0.05 0 l
+0.05 0 l
+0.17 0 l
+0.07 0 l
+0.04 0 l
+0.12 0 l
+0.04 0 l
+0.03 0 l
+0.11 0 l
+0.12 -0.71 l
+0.01 0 l
+0.11 0 l
+0.23 0 l
+0.06 0 l
+0.01 0 l
+0.61 0 l
+0.60 -0.49 l
+0.04 0 l
+0.06 0 l
+0.05 0 l
+0.29 -0.34 l
+0.17 0 l
+0.13 0 l
+0.21 0 l
+8.05 0 l
+0.62 22.91 l
+2.64 0 l
+0.33 0 l
+1.99 0 l
+4.01 0 l
+4.58 0 l
+0.71 32.90 l
+2.36 0 l
+7.24 0 l
+0.05 0 l
+1.35 0 l
+2.97 0 l
+0.19 0 l
+0.19 -0.65 l
+3.38 0 l
+0.02 0 l
+4.38 0 l
+1.67 0 l
+1.88 0 l
+0.36 0 l
+0.92 54.45 l
+15.89 0 l
+0.07 0 l
+1.87 0 l
+0.93 0 l
+4.78 0 l
+21.67 0 l
+1.54 0 l
+34.28 0 l
+12.35 0 l
+o
+ep
+%%Trailer
+%%Pages: 1
+%%EOF

Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/overview.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.html
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.html	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.html	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,454 @@
+<h2>DESCRIPTION</h2>
+
+r.connectivity.network is the 2nd tool of the r.connectivity.* tool-set and 
+performs network analysis (usig the igraph-package in R). It requires a network 
+dataset produced with r.connectivity.distance, and conducts analysis on graph, 
+edge and vertex level.
+
+<p>The analysis is based on a negative exponential decay kernel (as described 
+e.g. in Bunn et al. (2000), which characterizes the probability of dispersal 
+over increasing cost distance. The user can modify the function and thus 
+form of the kernel according to the dispersal characteristics of her/his 
+species or habitat type. Form of the curve can be controled with the <b>base</b> 
+and <b>exponent</b> options. The resulting kernel can be visually inspected 
+using the <b>x-flag</b>. If the <b>kernel_plot</b> option is given a plot 
+of the kernel is saved in the format depending on the ending of the file name 
+defined by the user.</p>
+
+If an overview plot is requested in the <em>overview</em> option, 
+network characteristics are visualised in a plot showing an overview over:
+<ul>
+<li>the number of connections,</li>
+<li>the number of components (clusters) and</li>
+<li>the size of the largest network component within the network</li>
+</ul>
+over increasing cost-distance between patches.
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_network_kernel.png">
+<img src="r_connectivity_network_kernel.png" width="600" height="600" 
+alt="Dispersal kernel used in the example below" border="0">
+</a><br>
+<i>Figure: Dispersal kernel used for network analysis in the example below.</i>
+</div>
+
+<h3>Output column names</h3>
+
+Due to limitations in dbf, the length of field names is limited to ten signs. 
+Thus, names of the edge and vertex measures are abbreviated in the vector 
+attribute table. This was (mostly) done using the following pattern for 
+column names (of vertex and edge measures):
+<dl>
+	<dd>weight _ measure _ (sub)graph</dd>
+</dl>
+
+<h3>(Sub)Graphs</h3>
+In r.connectivity.network a graph is build from the network dataset produced 
+in r.connectivity.distance. From this full and directed graph a set of 
+(sub)graphs is extracted, specified by:
+<ul>
+<li>u = for the undirected graph</li>
+<li>d = for the graph with only direct edges</li>
+<li>c = for the graph with only edges shorter than cost distance threshold</li>
+</ul>
+
+<h3>Graph measures</h3>
+
+<dl>
+
+<dd><b>Number of edges</b></dd>
+<dd>The number of edges is the number of connections between pairs of vertices 
+in the network.</dd>
+
+<dd><b>Number of vertices</b></dd>
+<dd>The number of vertices is the number of polygons (patches) from the input 
+vector map which are analysed in the r.connectivity.*.</dd>
+
+<dd><b>Cluster</b></dd>
+<dd> A cluster is a group of vertices which are connected with each other, but 
+not with the rest of vertices in a graph (a single isolated vertex can be a 
+cluster as well).</dd>
+
+<dd><b>Diameter</b></dd>
+<dd>The diameter of a graph is the length of the longest geodesic.</dd>
+
+<dd><b>Density</b></dd>
+<dd>The density of a graph is the ratio of the number of edges and the number 
+of possible edges.</dd>
+</dl>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_network_overview.png">
+<img src="r_connectivity_network_overview.png" width="600" height="600" 
+alt="Overview plot over fragmentation of the network with increasing" border="0">
+</a><br>
+<i>Figure: Overview plot over fragmentation of the network when edges of
+increasing length are removed, produced in the example below.</i>
+</div>
+
+<h3>Edge measures</h3>
+<dl>
+<dt><b>Input parameters</b></dt>
+<dd><b>con_id</b> = ID of the directed connection between two vertices (edge)</dd>
+<dd><b>con_id_u</b> = ID of the undirected connection between two vertices (edge)</dd>
+<dd><b>from_p</b> = Patch ID (patch_id) of the start-vertex of an (directed) edge</dd>
+<dd><b>from_pop</b> = Population proxy (pop_proxy) of the start-vertex of an (directed) edge</dd>
+<dd><b>to_p</b> = Patch ID (patch_id) of the end-vertex of an (directed) edge</dd>
+<dd><b>to_pop</b> = Population proxy (pop_proxy) of the end-vertex of an (directed) edge<br><br>
+</dd>
+
+
+<dt><b>Weights</b></dt>
+
+<dd><b>Cost distance (cd)</b></dd>
+<dd>Cost distance is calculated for the directed (cd) and undirected graph (cd_u). 
+The cd weight for directed edges is exactly like measured in r.connectivity.distance, 
+the cd weight for undirected edges is the average cost distance of the two directed edges 
+between a pair of vertices (mean( a--b, b-a)). The cost distance weight does not take the 
+user defined dispersal information (the population proxy for the different patches and 
+the dispersal kernel) into account.</dd>
+
+<dd><b>Negative exponential decay kernel flow (distk)</b></dd>
+<dd>The negative exponential decay kernel is defined by the variables <em>euler</em>, 
+<em>base</em>, and <em>exponent</em> specified by the user. It is calculated for the 
+directed (distk) and undirected edges(distk_u) using the following formulas:</dd>
+<dd><em>distk = euler ^ ( ( basis * ( 10 ^ exponent ) )*( cd))</em></dd>
+<dd><em>distk_u = euler ^ ( ( basis * ( 10 ^ exponent ) )*( cd_u))</em></dd>
+
+<dd><b>Maximum potential flow (mf)</b></dd>
+<dd>For the maximum potential flow (mf) weight the user defined dispersal information 
+(the population proxy and the dispersal kernel) is used to model the flow of propagules 
+between a pair of vertices. This weight is based on the assution that propagules disperse 
+evenly and in full amount into all sourrounding patches. Maximum potential flow is 
+calculated using the following formula:</dd>
+<dd>mf = disk * pop_proxy</dd>
+<dd>Maximum potential flow is calculated for the directed graph as incoming (mf_i) and 
+outgoing (mf_o) flow as well as for the undirected graph (mf_u). Unlike the cost distance 
+weight, mf represents the "closeness" of a pair of vertices. For some (most) algorithms it 
+had to be inverted in order to give meaningful results (mf_inv = Inverted maximum potential 
+flow for directed edges, mf_inv_u = Inverted maximum potential flow for undirected edges).</dd>
+
+<dd><b>Competing potential flow (cf)</b></dd>
+<dd>The competing potential flow (cf) weight is based on the work by Ranius & Roberge 2011. 
+Like in the maximum potential flow (mf) weight, the user defined dispersal information 
+(the population proxy and the negative exponential decay kernel) is used to model the flow 
+of propagules between a pair of vertices. But here it is assumed that the total amount 
+of propagules is limited to the population proxy given by the user, and that this amount 
+is distributed according to the "attractiveness" (defined by population size and cost 
+distance) of the surrounding patches.</dd>
+<dd>Competing potential flow is calculated for the directed (cf) and undirected (cf_u) 
+graph. Unlike the cost distance weight, cf represents the "closeness" between a pair 
+of vertices. For some (most) algorithms it had to be inverted in order to give meaningful 
+results (cf_inv = Inverted competing potential flow for directed edges, cf_inv_u = 
+Inverted competing potential flow for undirected edges).<br><br></dd>
+
+<dd>The mf and cf weights are inverted (mf_inv, cf_inv) by multiplying them with -1 
+followed by linear normalising to the original maximum and minimum values.<br><br></dd>
+
+
+
+<dt><b>Output parameters</b></dt>
+
+<dd><b>Shortest connections (isshort)</b></dd>
+<dd>In r.connectivity.network all edges are classified if they represent the 
+shortest path from the start- to the end-vertex, which is stored as a logical 
+value (0 = FALSE or 1 = TRUE). Shortest connections are identified for every 
+weight (isshort_cd, isshort_mf, isshort_cf). Finally the isshort attribute 
+is set to 1 if an edge represents the shortest path for either the cd-weight, 
+the mf-weight or the cf-weight (or 0 otherwise).</dd>
+
+<dd><b>Biconnected components (bc)</b></dd>
+<dd>If the removal of a single vertex and its adjacent edges does not disconnect 
+the graph (increase the number of clusters) it is part of a biconnected component.</dd>
+
+<dd><b>Bridges (is_br)</b></dd>
+<dd>A bridge is an edge who's removal increases the number of clusters in a graph. 
+Edges are classified either as bridge (1) or not (0).</dd>
+
+<dd><b>Edge betweenness (eb)</b></dd>
+<dd>The edge betweenness (eb) value represents the number of shortest paths that go 
+through an edge, considering the shortest paths between all possible pairs of vertices. 
+Edge betweenness is calculated with all three weights for the entire directed graph 
+(cd_eb_u, mf_eb_u, cf_eb_u), the undirected graph with only direct edges (cd_eb_ud, 
+mf_eb_ud, cf_eb_ud), and the undirected graph with only direct edges shorter than cost 
+distance threshold (cd_eb_udc, mf_eb_udc, cf_eb_udc).</dd>
+
+<dd><b>Local edge betweenness (leb)</b></dd>
+<dd>The local edge betweenness (leb) value represents the number of shortest paths
+ that go through an edge, considering the shortest paths between all possible 
+ pairs of vertices which are shorter than the user defined local 
+ neighbourhood (lnbh_threshold). Local edge betweenness is calculated with all 
+ three weights for the entire directed graph (cd_leb_u, mf_leb_u, cf_leb_u), 
+ the undirected graph with only direct edges  (cd_leb_ud, mf_leb_ud, cf_leb_ud), 
+ and the undirected graph with only direct edges shorter than cost distance 
+ threshold (cd_leb_udc, mf_leb_udc, cf_leb_udc).</dd>
+
+<dd><b>Edge betweenness community (ebc)</b></dd>
+<dd>Some groups of vertices can be densely connected with each other but only 
+little connected to other vertices. Such groups of relative intense connected 
+vertices are communities. One algorithm to identify communities in a graph is 
+edge betweenness community (ebc). Edge betweenness community is calculated 
+in an iterative loop, where, first edge betweenness is calculated, then the 
+edge with the largest edge betweenness value is removed, edge betweenness is 
+recalculated and so on. The algorithm produces mainly two edge measures:</dd>
+<dd>1. the order in which edges were deleted (ebc_r)</dd>
+<dd>2. the edge betweenness value of an edge at the time of removal</dd>
+
+<dd>For large graphs calculating edge betweenness community can take long time. 
+Therefore, it is only calculated on request (y-flag) and only for one weight (cf). 
+It is only calculated for the entire (undirected) graph.</dd>
+
+<dd><b>Minimum spanning trees (mst)</b></dd>
+<dd>A minimum spanning tree (mst) is a subgraph consisting of the minimal possible 
+number of edges  (= number of vertices - 1) connecting all vertices to a minimal 
+possible number of clusters, while the sum of all edge weights is minimised. 
+If the graph consists of more than one cluster, the result of the minimum spanning 
+tree algorithm is a so called minimum spanning forest, consisting of the minimum 
+spanning tree for each cluster. In the context of nature conservation, the minimum 
+spanning tree is sometimes referred to as the "backbone" of an area network 
+(Bunn etal. 2000). In r.connectivity.network the minimum spanning tree/forest 
+is calculated with all weights (cd, mf, cf) and for all undirected (sub)graphs 
+(u, ud, udc) resulting in the following (logical) edge measures: 
+cd_mst_u, cd_mst_ud, cd_mst_udc, mf_mst_u, mf_mst_ud, mf_mst_udc, 
+cf_mst_u, cf_mst_ud, cf_mst_udc, where edges are either part of the minimum 
+spanning tree/forest (1) or not (0).</dd>
+
+<dd><b>Potential cluster connectors (cl_pc_u)</b></dd>
+<dd>A cluster is a group of vertices which are connected with each other, but
+ not with the rest of vertices in a graph (a single isolated vertex can be a 
+cluster as well). Potential cluster connectors are edges which are longer 
+than the connectivity threshold, and connect clusters in the subgraph with 
+only edges shorter than the connectivity threshold.</dd>
+
+<dd><b>Potential community connectors (cf_ebc_pc, cf_iebc_pc)</b></dd>
+<dd>Potential community connectors are edges which connect communities identified 
+by the edge betweenness community algorithm for a user defined community level.</dd>
+</dl>
+
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_network_ebc_udc.png">
+<img src="r_connectivity_network_ebc_udc.png" width="600" height="600" 
+alt="Edge betweenness of the network for all edges on the Minimum 
+Spanning Tree (MST)" border="0">
+</a><br>
+<i>Figure: Edge betweenness of the network for all edges on the Minimum 
+Spanning Tree (MST).</i>
+</div>
+
+<h2>Vertex measures</h2>
+<dl>
+<dt><b>Input parameters</b></dt>
+<dd><b>Patch ID (patch_id)</b></dd>
+<dd>ID of the vertex = category value (cat) of the patch vector given by the user 
+in r.connectivity.distance.</dd>
+
+<dd><b>Population proxy (pop_proxy)</b></dd>
+<dd>The population proxy given by the user in r.connectivity.distance.</dd>
+
+<dt><b>Output parameters</b></dt>
+<dd><b>Cluster membership (cl)</b></dd>
+<dd>A cluster is a group of vertices which are connected with each other, 
+but not with the rest of vertices in a graph (a single isolated vertex is a 
+cluster as well). The cluster membership value (integer) is the id of the 
+cluster a vertex belongs to.
+
+<dd><b>Community structure and membership (cf_(i)ebc_cs, cf_(i)ebc_cl)</b></dd>
+<dd>The edge betweenness community algorithm is used to analyse the community 
+structure of a graph. It results in a hierarchical structure which describes 
+how a graph is split up by the edge removal process into an increasing number 
+of communities. The hierarchical community structure is stored as the 
+(character) vertex attribute "cf_ebc_cs". The community membership value 
+(integer) is the id of the community (identified by edge betweeenness community) 
+a vertex belongs to (on a user defined level of community division).</dd>
+
+<dd><b>Articulation points (art_p)</b></dd>
+<dd>Articulation points (art_p) are vertices who's removal would increase 
+the number of clusters in a graph. Articulation points are identified for 
+the entire directed graph (art_p_u), the undirected graph with only direct 
+edges (art_p_ud), and the undirected graph with only direct edges shorter 
+than cost distance threshold (art_p_udc). Articulation points (art_p) are a 
+(logical) measure of the graph structure and do not take edge weights into 
+account. Vertices are either articulation points (1) or not (0).</dd>
+
+<dd><b>Articulation (art)</b></dd>
+<dd>The articulation value (integer) (art) is the number of new clusters which 
+would occur when a vertex is removed. The articulation value (art) is a measure 
+of the graph structure and does not take edge weights into account.</dd>
+
+<dd><b>Degree centrality (deg)</b></dd>
+<dd>Degree centrality of a vertex is defined as the number of vertices connected 
+to this vertex. This (integer) measure is a measure of the graph structure and 
+does not take edge weights into account. Degree centrality is calculated for 
+all three undirected graphs (deg_u, deg_ud, deg_udc).</dd>
+
+<dd><b>Eigenvector centrality (evc)</b></dd>
+<dd>Eigenvector centrality (evc) in r.connectivity.network is a variation of the 
+eigenvector centrality algorithm provided by the igraph library (see also: Csardi 
+& Nepusz 2006). In r.connectivity.network eigenvector centrality is the sum of 
+incoming potential flow of a vertex.</dd>
+
+<dd>Because eigenvector centrality takes the direction of potential flows into 
+account it is calculated only for the directed graph and the directed graph with 
+only edges shorter than connectivity threshold, using both cf and mf weight 
+(cf_evc_u, cf_evc_uc, mf_evc_u, mf_evc_uc). Eigenvector centrality is stored 
+with double precision.</dd>
+
+
+<dd><b>Closeness centrality (cl)</b></dd>
+<dd>Cloness centrality represents the number of steps which are necessary 
+to access every other vertex from a given vertex. Closeness centrality 
+(integer) is calculated with all three weights for the entire directed 
+graph (cd_cl_u, mf_cl_u, cf_cl_u), the undirected graph with only direct 
+edges (cd_cl_ud, mf_cl_ud, cf_cl_ud), and the undirected graph with only 
+direct edges shorter than cost distance threshold 
+(cd_cl_udc, mf_cl_udc, cf_cl_udc).</dd>
+
+<dd><b>Vertex betweenness (vb)</b></dd>
+<dd>The vertex betweenness (vb) value represents the number of shortest paths 
+that go through a vertex (but that do not start or end in that vertex), 
+considering the shortest paths between all possible pairs of vertices. 
+Vertex betweenness is calculated with all three weights for the entire 
+directed graph (cd_vb_u, mf_vb_u, cf_vb_u), the undirected graph with 
+only direct edges  (cd_vb_ud, mf_vb_ud, cf_vb_ud), and the undirected 
+graph with only direct edges shorter than cost distance threshold 
+(cd_vb_udc, mf_vb_udc, cf_vb_udc).</dd>
+
+<dd><b>Local vertex betweenness (lvb)</b></dd>
+<dd>The local vertex betweenness (lvb) value represents the number of shortest 
+paths that go through a vertex (but that do not start or end in that vertex), 
+considering the shortest paths between all possible pairs of vertices wich are 
+shorter than the user defined local neighbourhood (lnbh_threshold). Local vertex 
+betweenness is calculated with all three weights for the entire directed graph 
+(cd_vb_u, mf_vb_u, cf_vb_u), the undirected graph with only direct edges 
+(cd_vb_ud, mf_vb_ud, cf_vb_ud), and the undirected graph with only direct edges 
+shorter than cost distance threshold (cd_vb_udc, mf_vb_udc, cf_vb_udc).</dd>
+
+<dd><b>Neighbourhood size (nbh_s)</b></dd>
+<dd>The neighbourhood size (nbh_s) is the number of of other vertices which 
+can be reached from a vertex.</dd>
+
+<dd><b>Local neighbourhood size (nbh_sl)</b></dd>
+<dd>The local neighbourhood size (nbh_sl) is the number of other vertices 
+which can be reached from a vertex along a path which is shorter than the 
+user defined local neighbourhood.</dd>
+
+</dl>
+<div align="center" style="margin: 10px">
+<a href="r_connectivity_network_deg_udc.png">
+<img src="r_connectivity_network_deg_udc.png" width="600" height="600" 
+alt="Eigenvector centrality computed for the patches in the network" border="0">
+</a><br>
+<i>Figure: Degree centrality computed for the patches in the network.</i>
+</div>
+
+<h2>REQUIREMENTS</h2>
+For running this tool R language and environment for statistical computing and graphics 
+has to be installed (see: <a href="http://www.r-project.org">http://www.r-project.org</a>) 
+together with the R-Python bridge rpy2.
+On Windows the path to R has to be added to the %path% variable in the environment settings 
+(see: <a href="http://grass.osgeo.org/wiki/R_statistics#MS_Windows">
+http://grass.osgeo.org/wiki/R_statistics#MS_Windows</a>) and GRASS GIS has to be started after 
+that.<br>Furthermore the <a href="http://cran.r-project.org/web/packages/igraph/index.html">
+igraph</a> package in R is required with version 1.0 or newer.<br>For parallel processing 
+(at the moment only supported for Linux) the R packages 
+<a href="http://cran.r-project.org/web/packages/doMC/index.html">doMC</a>, 
+<a href="http://cran.r-project.org/web/packages/multicore/index.html">multicore</a>, 
+<a href="http://cran.r-project.org/web/packages/iterators/index.html">iterators</a>, 
+<a href="http://cran.r-project.org/web/packages/codetools/index.html">codetools</a> and 
+<a href="http://cran.r-project.org/web/packages/foreach/index.html">foreach</a> are required as well.<br>
+All R packages can be installed by running the AddOn using the <b>i-flag (-i)</b>. 
+Installation of R packages requires internet access.<br>
+For postscript output (overview and kernel plot) also <a href="http://www.ghostscript.com/">ghostscript</a> 
+is required. 
+
+
+
+<h2>EXAMPLE</h2>
+
+<em>The following example is based on the North Carolina dataset 
+and continued from the example in r.connectivity.distance.</em><br>
+
+<h3>Analyse the network</h3>
+(r.connectivity.network)
+In the next step network analysis is performed. We define the connectivity 
+cutoff (maximum cost distance where connectivity is assumed) to be 1500.0 
+cost distance units, which represents the maximum known dispersal ability 
+of our species. The dispersal kernel is adjusted to characteristics of this 
+species by setting the exponent to -3, which gives a steeper decrease in 
+successful dispersal with increasing cost distance. Only very few dispersal 
+units of our species are expected to cross more than ca. 900 cost distance 
+units successfully (see: ./hws_connectivity/kernel.eps after running the 
+command or run it with the x-flag (-x) for only displaying the kernel).<br> 
+Connectivity metrics reslults are stored in te attribute table of the 
+vector maps on vertex (patches, map name: "prefix" _ vertex_measures) 
+and edge level (connections, map name: "prefix" _ edge_measures). 
+An overview over connectivity metrics on the graph level (the entire network) 
+is stored in "folder" (./hws_connectivity). We requested also an R-plot of 
+the dispersal kernel and an R-plot givig an overview over network 
+characteristics to be stored in the same folder.
+
+<p>Users with a multi-processor computer (e.g. dual-core) may speed up processing 
+by setting cores > 1 in r.connectivity.network.</p>
+
+<div class="code"><pre>
+r.connectivity.network -i input=hws_connectivity_edges \
+connectivity_cutoff=1500.0 lnbh_cutoff=2.0 cl_thres=10 exponent=-3 \
+kernel_plot=./kernel.eps overview_plot=./overview.eps \
+prefix=hws_connectivity cores=1
+</pre></div>
+
+
+
+<h2>REFERENCE</h2>
+<dl>
+<dt><b>Bunn, A. G., Urban, D. L. & Keitt, T. H. 2000</b>: Landscape connectivity: 
+A conservation application of graph theory. Journal of Environmental Management 
+(2000) 59: 265-278 
+<a href="http://www.sciencedirect.com/science/article/pii/S0301479700903736">
+http://www.sciencedirect.com/science/article/pii/S0301479700903736</a></dt>
+<dt><b>Calabrese, J. M. & Fagan, W. F. 2004</b>: A comparison-shopper's guide to 
+connectivity metrics. Front Ecol Environ 2 (10): 529-536 
+<a href="http://dx.doi.org/10.1890/1540-9295(2004)002[0529:ACGTCM]2.0.CO;2">
+http://dx.doi.org/10.1890/1540-9295(2004)002[0529:ACGTCM]2.0.CO;2</a></dt>
+<dt><b>Minor, E. S. & Urban, D. L. 2008</b>: A Graph-Theory Framework for 
+Evaluating Landscape Connectivity and Conservation Planning. Conservation 
+Biology 22 (2): 297-307 
+<a href="http://www.uic.edu/labs/minor/minor&urban2008.pdf">
+http://www.uic.edu/labs/minor/minor&urban2008.pdf</a></dt>
+<dt><b>Zetterberg, A.,  Mörtberg, U. M. & Balfors, B. 2010</b>: Making 
+graph theory operational for landscape ecological assessments, planning, and 
+design. Landscape and Urban Planning (2010) 95: 181-191 
+<a href="http://www.sciencedirect.com/science/article/pii/S0169204610000204">
+http://www.sciencedirect.com/science/article/pii/S0169204610000204</a></dt>
+<dt><b>Ranius, T. & Roberge, J.-M. 2011</b>: Effects of intensified forestry 
+on the landscape-scale extinction risk of dead wood dependent species. 
+Biodiversity and Conservation 20 (13): 2867-2882 
+<a href="http://www.springerlink.com/content/ch9qtv2665h624q4/">
+http://www.springerlink.com/content/ch9qtv2665h624q4/</a></dt>
+<dt><b>Framstad, E., Blumentrath, S., Erikstad, L. & Bakkestuen, V. 
+2012</b> (in Norwegian): Naturfaglig evaluering av norske verneområder. 
+Verneområdenes funksjon som økologisk nettverk og toleranse 
+for klimaendringer. NINA Rapport 888: 126 pp. Norsk institutt for 
+naturforskning (NINA), Trondheim. 
+<a href="http://www.nina.no/archive/nina/PppBasePdf/rapport/2012/888.pdf">
+	http://www.nina.no/archive/nina/PppBasePdf/rapport/2012/888.pdf</a></dt>
+<dt><b>Csardi G. & Nepusz T. 2006</b>: The igraph software package for 
+complex network research, InterJournal, Complex Systems 1695. 2006. 
+<a href="http://igraph.sf.net">http://igraph.sf.net</a></dt>
+<dt><b>Csardi, G. 2012</b>: igraph: Network analysis and visualization. 
+<a href="http://cran.r-project.org/web/packages/igraph/index.html">
+http://cran.r-project.org/web/packages/igraph/index.html</a></dt>
+</dl>
+
+
+<h2>SEE ALSO</h2>
+<em>
+<a href="r.connectivity.html">r.connectivity</a>, 
+<a href="r.connectivity.distance.html">r.connectivity.distance</a>, 
+<a href="r.connectivity.corridors.html">r.connectivity.corridors</a>
+</em>
+
+<h2>AUTHOR</h2>
+Stefan Blumentrath, Norwegian Institute for Nature Research (NINA)
+<br>
+<p></p><i>Last changed: $Date$</i>


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.html
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/html
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.py
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.py	                        (rev 0)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.py	2018-09-12 12:01:08 UTC (rev 73317)
@@ -0,0 +1,1584 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+"""
+MODULE:       r.connectivity.network
+AUTHOR(S):    Stefan Blumentrath <stefan dot blumentrath at nina dot no>
+PURPOSE:      Compute connectivity measures for a set of habitat patches
+              based on graph-theory (usig the igraph-package in R).
+
+              Recently, graph-theory has been characterised as an
+              efficient and useful tool for conservation planning
+              (e.g. Bunn et al. 2000, Calabrese & Fagan 2004,
+              Minor & Urban 2008, Zetterberg et. al. 2010).
+              As a part of the r.connectivity.* tool-chain,
+              r.connectivity.network is intended to make graph-theory
+              more easily available to conservation planning.
+
+              r.connectivity.network is the 2nd tool of the
+              r.connectivity.* toolchain and performs the (core) network
+              analysis (usig the igraph-package in R) on the network
+              data prepared with r.connectivity.distance. This network
+              data is analysed on graph, edge and vertex level.
+
+              Connectivity measures for the graph level are: number of
+              vertices, number of edges, number of clusters, size of the
+              largest cluster, average cluster size, diameter, density,
+              modularity, number of communities, community size (in
+              number of vertices) Network characteristics are visualised
+              in a plot showing an  overview over number of connections,
+              number of components and and the size of the largest
+              network component within the network with regards
+              to cost-distance between patches.
+
+              Connectivity measures calculated for the edges are:
+              Minimum-spanning-trees, directness, edge-betweenness,
+              local edge-betweenness, edge-betweenness-community,
+              bridges (biconnected components), tree edges
+              (biconnected components), and potential connectors of
+              clusters and communities.
+
+              Connectivity measures calculated for the vertices are:
+              Degree-centrality, Eigenvector-centrality, closeness
+              centrality, vertex-betweenness, local vertex-betweenness,
+              cluster-membership, edge betweenness community  structure,
+              community-membership, neighbourhood size, local
+              neighbourhood size, articulation points, and articulation.
+
+              Most measured can be calculated both on a directed and/or
+              an undirected graph.
+
+              Analysis is based on a negative exponential decay kernel
+              (as described e.g. in Bunn et al. (2000), which the user
+              can modify according to the dispersal characteristics of
+              her/his species or habitat type.
+
+              !!!This script is designed to work based on the output of
+              r.connectivity.distance!!!
+
+COPYRIGHT:    (C) 2011, 2018 by the Norwegian Institute for Nature
+                                    Research (NINA)
+
+              This program is free software under the GNU General Public
+              License (>=v2). Read the file COPYING that comes with
+              GRASS for details.
+
+########################################################################
+REQUIREMENTS:
+R with packages igraph (version 1.0) and nlme (for parallel processing
+doMC, multicore, iterators, codetools and foreach are required as well),
+ghostscript is required for postscript-output
+
+ToDo:
+- replace R with Python
+- add RGB columns instead of QML
+- Fix history assignment
+- - grass.parse_command('v.support', map=edges, flags='g')[comments]
+- - grass.parse_command('v.support', map=nodes, flags='g')[comments]
+"""
+
+#%Module
+#% description: Compute connectivity measures for a set of habitat patches based on graph-theory
+#% keywords: graph theory
+#% keywords: network
+#% keywords: network analysis
+#%End
+
+#%option G_OPT_V_INPUT
+#% required: yes
+#% key_desc: Network computed with r.connectivity.distance (input)
+#% description: Name of input vector map containing the network produced with r.connectivity.distance
+#%end
+
+#%option G_OPT_M_DIR
+#% type: string
+#% key: qml_style
+#% required: no
+#% description: Directory for output of QML files for layer styling in QGIS
+#%end
+
+#%option
+#% type: string
+#% key: prefix
+#% required: yes
+#% description: Prefix for output tables
+#%end
+
+#%option
+#% key: connectivity_cutoff
+#% type: double
+#% description: Maximum cost distance for connectivity
+#% guisection: Settings
+#% required: no
+#% answer: 0.0
+#%end
+
+#%option
+#% key: lnbh_cutoff
+#% type: double
+#% description: Threshold defining a locale neighborhood (neighborhood = number of times connectivity_cutoff)
+#% guisection: Settings
+#% required: no
+#% answer: 3.0
+#%end
+
+#%option
+#% key: convergence_threshold
+#% type: double
+#% description: Convergence threshold for the overview plot over the graph
+#% guisection: Settings
+#% required: no
+#% answer: 0.05
+#%end
+
+#%option
+#% key: cl_thres
+#% type: integer
+#% description: Number of community levels to be traced in edge betweenness community
+#% guisection: Settings
+#% required: no
+#% answer: 0
+#%end
+
+# Temporarily disabled
+##%flag
+##% key: y
+##% description: Calculate edge betweenness community (default is do not).
+##% guisection: Measures
+##%end
+
+#%option
+#% key: base
+#% type: double
+#% description: A factor for defining the shape of the negative exponential decay kernel (e ^ base * exponent)
+#% guisection: Kernel
+#% required: no
+#% answer: -3.0
+#%end
+
+#%option
+#% key: exponent
+#% type: double
+#% description: Exponent of the negative exponential decay kernel (e ^ base * exponent)
+#% guisection: Kernel
+#% required: no
+#% answer: -4.5
+#%end
+
+#%flag
+#% key: x
+#% description: Visualise negative exponential decay kernel and exit
+#% guisection: Output
+#%end
+
+#%option G_OPT_F_OUTPUT
+#% key: kernel_plot
+#% description: File name for a plot of the negative exponential decay kernel (e ^ base * exponent) used in analysis (requires ghostscript installed)
+#% required : no
+#% guisection: Output
+#%end
+
+#%option G_OPT_F_OUTPUT
+#% key: overview_plot
+#% description: File name for a plot of an overview over network characteristics (requires ghostscript installed)
+#% required : no
+#% guisection: Output
+#%end
+
+#%option
+#% key: cores
+#% type: integer
+#% description: Number of cores to be used for computation (if <= 1 no parallelisation is applied)
+#% guisection: Parallelisation
+#% required: no
+#% answer: 1
+#%end
+
+#%flag
+#% key: i
+#% description: Install required R packages in an interactive session if they are missing
+#%end
+
+#%flag
+#% key: r
+#% description: Remove indirect connections from network
+#%end
+
+import atexit
+import os
+import sys
+import platform
+import warnings
+import numpy as np
+import matplotlib
+# Required for Windows
+matplotlib.use('wx')
+import matplotlib.pyplot as plt
+import grass.script as grass
+import grass.script.task as task
+import grass.script.db as grass_db
+
+
+# Check if script is started from within GRASS
+if not os.environ.has_key("GISBASE"):
+    grass.message("You must be in GRASS GIS to run this program.")
+    sys.exit(1)
+
+def cleanup():
+    """tmp_maps = grass.read_command("g.list",
+                                  type=['vector', 'raster'],
+                                  pattern='{}*'.format(TMP_prefix),
+                                  separator=',')
+
+    if tmp_maps:
+        grass.run_command("g.remove", type=['vector', 'raster'],
+                          pattern='{}*'.format(TMP_prefix), quiet=True,
+                          flags='f')
+    #grass.del_temp_region()"""
+    pass
+
+
+def is_number(string):
+    """Check if a string can be converted to numeric"""
+
+    try:
+        complex(string) # for int, long, float and complex
+    except ValueError:
+        return False
+
+    return True
+
+
+def main():
+    """Do the main work"""
+
+    try:
+		import rpy2
+		import rpy2.rinterface
+		rpy2.rinterface.set_initoptions((b'rpy2', b'--no-save',
+										 b'--no-restore', b'--quiet'))
+		import rpy2.robjects as robjects
+		# rpy2 throws lots of warnings (that cannot be suppressed)
+		# when packages are loaded
+		warnings.filterwarnings("ignore")
+		import rpy2.robjects.packages as rpackages
+		from rpy2.robjects.vectors import StrVector
+		import rpy2.robjects.numpy2ri
+    except ImportError:
+        grass.fatal(_("Cannot import rpy2 (https://rpy2.bitbucket.io)"
+                      " library."
+                      " Please install it (pip install rpy2)"
+                      " or ensure that it is on path"
+                      " (use PYTHONPATH variable)."))
+    #Input variables
+    network_map = options['input']
+    # network_mapset = network_map.split('@')[0]
+    # network = network_map.split('@')[1] if len(network_map.split('@'))
+    # > 1 else None
+    prefix = options['prefix']
+    cores = options['cores']
+    convergence_treshold = options['convergence_threshold']
+    euler = np.exp(1)
+    base = float(options['base'])
+    exponent = float(options['exponent'])
+    qml_style_dir = options['qml_style']
+    if is_number(options['connectivity_cutoff']):
+        if float(options['connectivity_cutoff']) > 0:
+            connectivity_cutoff = float(options['connectivity_cutoff'])
+        else:
+            grass.fatal('"connectivity_cutoff" has to be > 0.')
+    else:
+        grass.fatal('Option "connectivity_cutoff" is not given as a number.')
+    lnbh_cutoff = options['lnbh_cutoff']
+    cl_thresh = options['cl_thres']
+
+    cd_cutoff = connectivity_cutoff
+
+    kernel_plot = options['kernel_plot']
+    overview_plot = options['overview_plot']
+
+    verbose = grass.verbosity() == 3
+    overwrite = grass.overwrite()
+
+    edge_output = '{}_edge_measures'.format(prefix)
+    edge_output_tmp = '{}_edge_measures_tmp'.format(prefix)
+    vertex_output = '{}_vertex_measures'.format(prefix)
+    vertex_output_tmp = '{}_vertex_measures_tmp'.format(prefix)
+    network_output = '{}_network_measures'.format(prefix)
+
+    # Check if input parameters are correct
+    for table in [vertex_output, edge_output, network_output]:
+        if grass.db.db_table_exist(table) and not overwrite:
+            grass.fatal('Table "{}" already exists. \
+                         Use --o flag to overwrite'.format(table))
+
+    if qml_style_dir:
+        if not os.path.exists(qml_style_dir):
+            grass.fatal('QML output requested but directory "{}" \
+                        does not exists.'.format(qml_style_dir))
+        if not os.path.isdir(qml_style_dir):
+            grass.fatal('QML output requested but "{}" is not a \
+                        directory.'.format(qml_style_dir))
+        if not os.access(qml_style_dir, os.R_OK):
+            grass.fatal('Output directory "{}" for QML files is not \
+                        writable.'.format(qml_style_dir))
+
+    for plot in [kernel_plot, overview_plot]:
+        if plot:
+            if not os.path.exists(os.path.dirname(plot)):
+                grass.fatal('Directory for output "{}" does not \
+                            exists.'.format(plot))
+            if not os.access(os.path.dirname(plot), os.R_OK):
+                grass.fatal('Output directory "{}" is not \
+                            writable.'.format(plot))
+
+    # Visualise negative exponential decay kernel and exit
+    x_flag = flags['x']
+
+    # Calculate edge betweenness community (default is do not)
+    # y_flag = flags['y']
+
+    # Install missing R packages
+    i_flag = flags['i']
+
+    # Remove indirect connections from network
+    r_flag = flags['r']
+
+    db_connection = grass_db.db_connection()
+    # parse_command('db.connect', flags='g')
+    db_name = grass.read_command('db.databases').rstrip('\n')
+
+    net_hist_str = grass.parse_command('v.info', map=network_map,
+                                      flags='h', delimiter=':'
+                                      )['COMMAND'].split('\n')[0]
+    # grass.parse_command('v.info', map=network_map, flags='h'
+    #                     ).split('\n')[0].split(': ')[1]
+    # Parsing goes wrong in some cases (extractig with -tp) as input
+    dist_cmd_dict = task.cmdstring_to_tuple(net_hist_str)
+    command = os.environ['CMDLINE']
+
+    dist_prefix = dist_cmd_dict[1]['prefix']
+    pop_proxy = dist_cmd_dict[1]['pop_proxy']
+
+    in_vertices = '{}_vertices'.format(dist_prefix)
+
+    # OS adjustment
+    os_type = platform.system()
+
+    robjects.numpy2ri.activate()
+
+    grass.verbose("prefix is {}".format(prefix))
+    grass.verbose("cores is {}".format(cores))
+    grass.verbose("convergence_treshold is {}".format(convergence_treshold))
+    grass.verbose("euler is {}".format(euler))
+    grass.verbose("base is {}".format(base))
+    grass.verbose("exponent is {}".format(exponent))
+    grass.verbose("cd_cutoff is {}".format(cd_cutoff))
+    grass.verbose("connectivity_cutoff is {}".format(connectivity_cutoff))
+    grass.verbose("lnbh_cutoff is {}".format(lnbh_cutoff))
+    grass.verbose("kernel_plot is {}".format(kernel_plot))
+    grass.verbose("overview_plot is {}".format(overview_plot))
+    grass.verbose("dist_prefix is {}".format(dist_prefix))
+    grass.verbose("EDGES is {}_edges".format(prefix))
+    grass.verbose("VERTICES is {}_vertices".format(prefix))
+    grass.verbose("cl_thresh is {}".format(cl_thresh))
+
+
+    #Check if R is installed
+    if not grass.find_program('R'):
+        grass.fatal("R is required, but can not be found on the system.\n \
+                    Please make sure that R is installed and the path \
+                    to R is added to the environment variables \
+                    (see: http://grass.osgeo.org/wiki/R_statistics#MS_Windows). \
+                    After that a restart of GRASS GIS is required.")
+
+    #Visualise the negative exponential decay kernel and exit (if requested)
+    if x_flag:
+        rscript = """euler <- {euler}
+        basis <- {base}
+        exponent <- {exponent}
+        cd_cutoff <- {cd_cutoff}
+        matplot((0:cd_cutoff/1000),
+                (euler^((basis*(10^exponent))*(0:cd_cutoff))),
+                type=\"l\",
+                xlab=c(\"Cost distance (in 1000)\"),
+                ylab=\"Potential flow between patches\")
+        locator(n = 1, type = \"n\")""".format(euler=euler,
+                                               base=base,
+                                               exponent=exponent,
+                                               cd_cutoff=cd_cutoff)
+
+    if x_flag or kernel_plot:
+        if x_flag:
+            plt.ion()
+
+        fig = plt.figure()
+        # ax = plt.axes()
+        x_values = np.linspace(0, cd_cutoff, 1000)
+
+        plt.plot(x_values, np.exp(base*(np.power(10.0,
+                                                 exponent))*x_values))
+
+        # Simplified version could be
+        # plt.plot(x, np.exp(exponent*x))
+
+        if x_flag:
+            fig.show()
+            plt.waitforbuttonpress()
+            sys.exit(0)
+        elif kernel_plot:
+            fig.savefig(kernel_plot)
+
+    if cores > 1 and os_type == "Windows":
+        grass.warning('Parallel processing not yet supported on MS Windows. \
+                       Setting number of cores to 1.')
+        cores = 1
+
+    #Check if ghostscript is installed
+    if overview_plot:
+        if os_type == "Windows":
+            # grass.warning("Ghostscript is required. Assuming
+            # ghostscript is installed on MS Windows")
+            # Check for ghostscript deactivated on Windows because the
+            # path to gswin32 is not defined in the environment settings
+            # by ghostscript installation automatically
+            if not grass.shutil_which('gswin32') and not grass.shutil_which('gswin32.exe'):
+                grass.fatal("ghostscript is required for postscript \
+                            output, can not find ghostscript \
+                            (gswin32.exe), please install ghostscript \
+                            first (or check environment path settings)")
+
+        else:
+            if not grass.shutil_which('gs') and not grass.shutil_which('ghostscript'):
+                grass.fatal("ghostscript is required for postscript \
+                            output, please install ghostscript first")
+
+    req_packages = ["igraph", "nlme", "rgrass7", "DBI"]
+    if cores > 1 and os_type != "Windows":
+        req_packages = req_packages + ["doMC", "foreach",
+                                       "iterators", "codetools"]
+
+    rscript = 'unique(sort(row.names(installed.packages())))'
+    installed_packages = robjects.r(rscript)
+
+    missing_packages = np.setdiff1d(req_packages, installed_packages)
+
+    if i_flag and missing_packages:
+        grass.warning('Installing required R-packages {} on \
+                      request.'.format(','.join(missing_packages)))
+        utils = rpackages.importr('utils')
+        utils.chooseCRANmirror(ind=1)
+        utils.install_packages(StrVector(missing_packages))
+    elif missing_packages:
+        grass.fatal('The following required R-packages {} are issing \
+                    on your system. Please install \
+                    them.'.format(','.join(missing_packages)))
+
+    #Check igraph version
+    rscript = """if(as.double(substr(
+                    packageDescription("igraph",
+                                       fields = c("Version")),1,3)
+                    )<=0.6) packageDescription("igraph",
+                                               fields = c("Version"))"""
+    igraph_version = robjects.r(rscript)
+
+    if not isinstance(igraph_version, rpy2.rinterface.RNULLType):
+        if i_flag:
+            grass.warning('The required igraph version is 0.6-2 or \
+                          later, the installed version is {}. \
+                          Installing latest version of igraph on \
+                          request.'.format(igraph_version))
+            utils.install_packages('igraph')
+        else:
+            grass.fatal('The required igraph version is 0.6-2 or \
+                         later, the installed version is {}. \
+                         Please download and install at least igraph \
+                         version 0.6-2'.format(igraph_version))
+
+    rscript = """
+########################################################################
+###Preparation
+########################################################################
+verbose <- {}
+
+if (verbose) {{
+cat("Loading variables and packages...\n")
+}}
+
+library(igraph)
+library(nlme)
+library(codetools)
+library(rgrass7)
+library(DBI)
+""".format('{}'.format(verbose).upper())
+
+    if cores > 1:
+        rscript += """
+# library(multicore)
+library(iterators)
+library(foreach)
+library(doMC)
+
+registerDoMC()
+options(cores = {})
+""".format(cores)
+
+    rscript += """
+# Variables
+convergence_threshold <- {convergence_treshold}
+euler <- {euler}
+basis <- {base}
+exponent <- {exponent}
+remove_indirect <- {r_flag}
+cd_cutoff <- {cd_cutoff}
+connectivity_cutoff <- {connectivity_cutoff}
+lnbh_cutoff <- {lnbh_cutoff}
+cl_thres <- {cl_thresh}
+db <- "{database}"
+db_driver <- "{driver}"
+db_schema <- "{schema}"
+qml_directory <- '{qml_style_dir}'
+in_edges <- "{network_map}"
+in_vertices <- '{in_vertices}'
+overwrite <- {overwrite}
+command <- '{command}'
+pop_proxy <- '{pop_proxy}'
+
+#Output files
+#Path to kernel plot file
+decay_kernel_ps <- '{kernel_plot}'
+
+#Path to output overview plot file
+network_overview_ps <- '{overview_plot}'
+
+# Tables with connectivity measures
+network_output <- '{network_output}'
+vertex_output <- '{vertex_output}'
+edge_output <- '{edge_output}'
+""".format(convergence_treshold=convergence_treshold,
+           euler=euler,
+           base=base,
+           exponent=exponent,
+           pop_proxy=pop_proxy,
+           r_flag='{}'.format(r_flag).upper(),
+           cd_cutoff=cd_cutoff,
+           connectivity_cutoff=connectivity_cutoff,
+           lnbh_cutoff=lnbh_cutoff,
+           cl_thresh=cl_thresh,
+           kernel_plot=kernel_plot,
+           overview_plot=overview_plot,
+           driver=db_connection['driver'],
+           database=db_name,
+           schema=db_connection['schema'],
+           qml_style_dir=qml_style_dir,
+           in_vertices=in_vertices,
+           edge_output=edge_output_tmp,
+           vertex_output=vertex_output_tmp,
+           network_output=network_output,
+           network_map=network_map,
+           overwrite='{}'.format(overwrite).upper(),
+           command=command)
+
+    rscript += """
+#network_measures <- paste(prefix, "network_measures", sep="_")
+#edge_output <- paste(prefix, "edge_measures", sep="_")
+#vertex_output <- paste(prefix, "vertex_measures", sep="_")
+#network_output <- paste(prefix, "network_measures", sep="_")
+
+if (decay_kernel_ps != "") {
+if (verbose) {
+cat("Exporting a plot of the negative exponential decay kernel...\n")
+}
+
+########################################################################
+#Plot the negative exponential decay kernel
+ps.options(encoding="CP1257.enc", family="Helvetica", horizontal=FALSE, fonts="Helvetica", paper="a4", pointsize=1/96, height=3.5, width=3.5)
+postscript(decay_kernel_ps)
+matplot((0:cd_cutoff/(10^(nchar(as.integer(cd_cutoff))-2))), (euler^((basis*(10^exponent))*(0:cd_cutoff))), type="l", xlab=paste(c("Cost distance (in ", as.character(10^(nchar(as.integer(cd_cutoff))-2)), ")"), sep="", collapse=""), ylab="Potential flow between patches")
+off <- dev.off(dev.cur())
+}
+
+########################################################################
+###Construct graph
+if (verbose) {
+cat("Reading and preparing input data...\n")
+}
+
+goutput <- execGRASS('v.db.select', map=in_vertices, columns=paste('cat', pop_proxy, sep=','), separator=',', intern=TRUE)
+con <- textConnection(goutput)
+v <- read.csv(con, header=TRUE)
+names(v) <- c('patch_id', 'pop_proxy')
+
+#Read and group edge data
+goutput <- execGRASS('v.db.select', map=in_edges, columns='cat,from_p,to_p,dist', separator=',', intern=TRUE)
+con <- textConnection(goutput)
+e_df <- read.csv(con, header=TRUE)
+
+#e_df <- data.frame(from_p=e_pre[,1], to_p=e_pre[,2], dist=e_pre[,3])
+#e_groups <- groupedData(dist ~ from_p | from_p/to_p, data=as.data.frame(e_df), FUN=mean)
+#e_grouped <- gsummary(e_groups, mean)
+con_id_u_pre <- unlist(mclapply(1:length(e_df$from_p), function(x) paste(sort(c(e_df$from_p[x], e_df$to_p[x]))[1], sort(c(e_df$from_p[x], e_df$to_p[x]))[2], sep="_")))
+con_id_u_pre_df <- data.frame(con_id_u_pre=unique(con_id_u_pre), con_id_u=1:length(unique(con_id_u_pre)))
+e_grouped_df_pre <- merge(data.frame(con_id_u_pre=con_id_u_pre, con_id=1:length(e_df$from_p), from_p=e_df$from_p, to_p=e_df$to_p, dist=e_df$dist), con_id_u_pre_df, all.x=TRUE)
+e_groups_ud <- groupedData(dist ~ 1 | con_id_u, data=e_grouped_df_pre, FUN=mean)
+e_grouped_ud <- gsummary(e_groups_ud, mean)
+e_grouped_ud_df <- data.frame(con_id_u=as.vector(e_grouped_ud$con_id_u), dist_ud=as.vector(e_grouped_ud$dist))
+e_grouped_df <- merge(data.frame(con_id=as.integer(e_grouped_df_pre$con_id), con_id_u=as.integer(e_grouped_df_pre$con_id_u), from_p=as.integer(e_grouped_df_pre$from_p), to_p=as.integer(e_grouped_df_pre$to_p), dist=as.double(e_grouped_df_pre$dist)), e_grouped_ud_df, all.x=TRUE)
+
+##Remove connections longer than cost distance threshold if requested
+#if(remove_longer_cutoff == 1) {
+#con_id_true <-  e_grouped_df$con_id[grep(TRUE, e_grouped_df$dist_ud<cd_cutoff)]
+#e_grouped_df_pre <- merge(data.frame(con_id=con_id_true), e_grouped_df)
+#con_id_u_df <- data.frame(con_id_u_old=unique(e_grouped_df_pre$con_id_u), con_id_u=1:length(unique(e_grouped_df_pre$con_id_u)))
+#e_grouped_df <- merge(data.frame(con_id_old=e_grouped_df_pre$con_id, con_id_u_old=e_grouped_df_pre$con_id_u, con_id=1:length(e_grouped_df_pre$con_id), from_p=e_grouped_df_pre$from_p, to_p=e_grouped_df_pre$to_p, dist=e_grouped_df_pre$dist, dist_ud=e_grouped_df_pre$dist_ud), con_id_u_df, all.x=TRUE)
+#}
+
+#Merge vertex and grouped edge data
+from_pop <- merge(data.frame(con_id=e_grouped_df$con_id, from_p=e_grouped_df$from_p), data.frame(from_p=as.integer(v$patch_id), from_pop=as.double(v$pop_proxy)), all.x=TRUE, sort=FALSE)
+to_pop <- merge(data.frame(con_id=e_grouped_df$con_id, to_p=e_grouped_df$to_p), data.frame(to_p=as.integer(v$patch_id), to_pop=as.double(v$pop_proxy)), all.x=TRUE, sort=FALSE)
+e <- merge(merge(from_pop, to_pop, sort=TRUE), data.frame(con_id=e_grouped_df$con_id, con_id_u=e_grouped_df$con_id_u, cost_distance=e_grouped_df$dist, cd_u=e_grouped_df$dist_ud), by="con_id", sort=TRUE)
+
+#Calculate attributes representing proxies for potential flow between patches
+distance_weight_e <- euler^((basis*(10^exponent))*(e$cost_distance))
+distance_weight_e_ud <- euler^((basis*(10^exponent))*(e$cd_u))
+#out_areal_distance_weight_e <- e$from_pop*distance_weight_e
+#in_areal_distance_weight_e <- e$to_pop*distance_weight_e
+
+mf_o <- e$from_pop*distance_weight_e
+mf_i <- e$to_pop*distance_weight_e
+mf_u <- e$from_pop*distance_weight_e_ud+e$from_pop*distance_weight_e_ud
+
+mf_o_inv <- mf_o^-1
+mf_i_inv <- mf_i^-1
+mf_inv_u <- ((mf_u*-1)-min(mf_u*-1))*(ifelse(max(mf_u)>10000000000000000,10000000000000000,max(mf_u))-ifelse(min(mf_u)<0.000000000001,0.000000000001,min(mf_u)))/(max(mf_u*-1)-min(mf_u*-1))+ifelse(min(mf_u)<0.000000000001,0.000000000001,min(mf_u))
+
+flow_df <- data.frame(from_p=e$from_p, mf_i=mf_i)
+sum_mf_i_groups <- groupedData(mf_i ~ from_p | from_p, data=as.data.frame(flow_df), FUN=sum)
+sum_mf_i_pre <- gsummary(sum_mf_i_groups, sum)
+sum_mf_i <- data.frame(from_p=as.integer(as.character(sum_mf_i_pre[,1])), sum_mf_i=as.double(sum_mf_i_pre[,2]))
+
+tmp <- merge(merge(e, data.frame(con_id=e$con_id, distance_weight_e_ud=distance_weight_e_ud, distance_weight_e=distance_weight_e, mf_o=mf_o, mf_o_inv=mf_o_inv, mf_i=mf_i, mf_i_inv=mf_i_inv, mf_u=mf_u, mf_inv_u=mf_inv_u)), sum_mf_i)
+cf <- tmp$mf_o*(tmp$mf_i/tmp$sum_mf_i)
+#cf <- (cf-rep(min(cf),length(cf)))*(1/(rep(max(cf),length(cf))-rep(min(cf),length(cf))))
+#cf_inv <- cf^-1
+#igraphs limits for weights in edge.betweenness function are aproximately max 12600000000000000 and min 0.000000000001
+cf_inv <- ((cf*-1)-min(cf*-1))*(ifelse(max(cf)>10000000000000000,10000000000000000,max(cf))-ifelse(min(cf)<0.000000000001,0.000000000001,min(cf)))/(max(cf*-1)-min(cf*-1))+ifelse(min(cf)<0.000000000001,0.000000000001,min(cf))
+
+e <- merge(tmp, data.frame(con_id=e$con_id, cf=cf, cf_inv=cf_inv), by="con_id", sort=TRUE)
+
+cf_u_df <- data.frame(con_id_u=e$con_id_u, cf=e$cf, cf_inv=e$cf_inv)
+cf_u_groups <- groupedData(cf ~ 1 | con_id_u, data=cf_u_df, FUN=sum)
+cf_u_grouped <- gsummary(cf_u_groups, sum)
+
+e <- merge(e, data.frame(con_id_u=as.vector(cf_u_grouped$con_id_u), cf_u=as.vector(cf_u_grouped$cf), cf_inv_u=((as.vector(cf_u_grouped$cf)*-1)-min(as.vector(cf_u_grouped$cf)*-1))*(ifelse(max(as.vector(cf_u_grouped$cf))>10000000000000000,10000000000000000,max(as.vector(cf_u_grouped$cf)))-ifelse(min(as.vector(cf_u_grouped$cf))<0.000000000001,0.000000000001,min(as.vector(cf_u_grouped$cf))))/(max(as.vector(cf_u_grouped$cf)*-1)-min(as.vector(cf_u_grouped$cf)*-1))+ifelse(min(as.vector(cf_u_grouped$cf))<0.000000000001,0.000000000001,min(as.vector(cf_u_grouped$cf)))), all.x=TRUE)
+
+#Collapse edge data for undirected graph
+con_id_u_unique <- unique(e$con_id_u)
+ud_groups <- groupedData(con_id ~ 1 | con_id_u, data=data.frame(con_id_u=e$con_id_u, con_id=e$con_id), FUN=mean)
+ud_grouped <- gsummary(ud_groups)
+ud_grouped_df <- data.frame(con_id_u=as.vector(ud_grouped$con_id_u), con_id_avg=as.vector(ud_grouped$con_id))
+e_ud_pre <- merge(e, ud_grouped_df, all.x=TRUE)
+first_con_id <- data.frame(con_id=e_ud_pre$con_id[e_ud_pre$con_id_avg>e_ud_pre$con_id])
+e_ud <- merge(first_con_id, e)
+
+#Merge vertices and edges to graph-object
+#Build directed graph
+if (verbose) {
+cat("Building the graph...\n")
+}
+
+g <- graph.empty()
+g <- add.vertices(g, nrow(v), patch_id=as.character(v$patch_id), pop_proxy=as.numeric(v$pop_proxy))
+names <- V(g)$patch_id
+ids <- 1:length(names)
+names(ids) <- names
+from <- as.character(e$from_p)
+to <- as.character(e$to_p)
+edges <- matrix(c(ids[from], ids[to]), nc=2)
+g <- add.edges(g, t(edges), con_id=e$con_id, con_id_u=e$con_id_u, from_p=e$from_p, from_pop=e$from_pop, to_p=e$to_p, to_pop=e$to_pop, cost_distance=e$cost_distance, cd_u=e$cd_u, distance_weight_e=e$distance_weight_e, distance_weight_e_ud=e$distance_weight_e_ud, mf_o=e$mf_o, mf_o_inv=e$mf_o_inv, mf_i=e$mf_i, mf_i_inv=e$mf_i_inv, mf_u=e$mf_u, mf_inv_u=e$mf_inv_u, cf=e$cf, cf_inv=e$cf_inv, cf_u=e$cf_u, cf_inv_u=e$cf_inv_u)
+
+#Build undirected graph
+g_ud <- as.undirected(graph.empty())
+g_ud <- add.vertices(g_ud, nrow(v), patch_id=as.character(v$patch_id), pop_proxy=as.numeric(v$pop_proxy))
+names <- V(g_ud)$patch_id
+ids <- 1:length(names)
+names(ids) <- names
+from <- as.character(e_ud$from_p)
+to <- as.character(e_ud$to_p)
+edges <- matrix(c(ids[from], ids[to]), nc=2)
+g_ud <- add.edges(g_ud, t(edges), con_id=e_ud$con_id, con_id_u=e_ud$con_id_u, from_p=e_ud$from_p, from_pop=e_ud$from_pop, to_p=e_ud$to_p, to_pop=e_ud$to_pop, cost_distance=e_ud$cost_distance, cd_u=e_ud$cd_u, distance_weight_e=e_ud$distance_weight_e, mf_o=e_ud$mf_o, mf_o_inv=e_ud$mf_o_inv, mf_i=e_ud$mf_i, mf_i_inv=e_ud$mf_i_inv, mf_u=e_ud$mf_u, mf_inv_u=e_ud$mf_inv_u, cf=e_ud$cf, cf_inv=e_ud$cf_inv, cf_u=e_ud$cf_u, cf_inv_u=e_ud$cf_inv_u)
+
+#Classify connection with regards to shortest paths
+#con_id_u <- unlist(lapply(0:(length(E(g))-1), function(x) E(g, path=c(sort(array(c(ends(g, x)[1], ends(g, x)[2])))[1], sort(array(c(ends(g, x)[1], ends(g, x)[2])))[2]))))
+#l1 <- unlist(lapply(1:length(V(g_ud)), function(x) rep(x, length(V(g_ud)))))
+#l2 <- rep(1:length(V(g_ud)), length(V(g_ud)))
+#fa <- function(a) get.shortest.paths(g_ud, l1[a], l2[a], weights=E(g_ud)$cd_u)
+#sp <- fa(1:length(l1))
+#Set edge attributes
+#E(g)$con_id_u <- con_id_u
+
+#E(g)$cd_u <- unlist(mclapply(0:(length(E(g))-1), function(x) (E(g)[x]$cost_distance+E(g, path=c(ends(g, x)[2], ends(g, x)[1]))$cost_distance)/2))
+
+####################################
+###Can the following be vectorised????
+
+E(g_ud)$isshort_cd <- as.integer(unlist(mclapply(1:(length(E(g_ud))), function(x) length(get.shortest.paths(g_ud, from=ends(g_ud, x)[1], to=ends(g_ud, x)[2], weights=E(g_ud)$cd_u)$vpath[[1]])))==2)
+E(g_ud)$isshort_mf <- as.integer(unlist(mclapply(1:(length(E(g_ud))), function(x) length(get.shortest.paths(g_ud, from=ends(g_ud, x)[1], to=ends(g_ud, x)[2], weights=E(g_ud)$mf_inv_u)$vpath[[1]])))==2)
+E(g_ud)$isshort_cf <- as.integer(unlist(mclapply(1:(length(E(g_ud))), function(x) length(get.shortest.paths(g_ud, from=ends(g_ud, x)[1], to=ends(g_ud, x)[2], weights=E(g_ud)$cf_inv_u)$vpath[[1]])))==2)
+E(g_ud)$isshort <- ifelse((E(g_ud)$isshort_cd==0 & E(g_ud)$isshort_mf==0 & E(g_ud)$isshort_cf==0), 0, 1)
+####################################
+
+#Add edge attributes to directed graph (for export)
+#E(g)$isshort[grep(TRUE, E(g)$con_id_u %in% E(g_ud)$con_id_u[grep(TRUE, E(g_ud)$isshort)])] <- TRUE
+#E(g)$isshort[grep(TRUE, E(g)$con_id_u %in% E(g_ud)$con_id_u[grep(FALSE, E(g_ud)$isshort)])] <- FALSE
+
+#Remove indirect connections if requested
+#if(remove_indirect == 1) {
+g_ud_d <- delete.edges(g_ud, E(g_ud)[E(g_ud)$isshort==FALSE])
+#g_ud <- delete.edges(g_ud, E(g_ud)[E(g_ud)$isshort==FALSE])
+#}
+
+#Remove connections above connectivity threshold if requested
+if(connectivity_cutoff >= 0.0) {
+g_ud_cd <- delete.edges(g_ud, E(g_ud)[grep(TRUE, E(g_ud)$cd_u>=connectivity_cutoff)])
+g_ud_d_cd <- delete.edges(g_ud_d, E(g_ud_d)[grep(TRUE, E(g_ud_d)$cd_u>=connectivity_cutoff)])
+}
+
+########################################################################
+###Analysis on graph level
+########################################################################
+
+if (verbose) {
+cat("Starting analysis on graph level...\n")
+}
+
+###graph measures
+vertices_n <- length(V(g_ud_d))
+edges_n <- length(E(g_ud))
+edges_n_d <- length(E(g_ud_d))
+edges_n_cd <- length(E(g_ud_cd))
+edges_n_d_cd <- length(E(g_ud_d_cd))
+
+
+########################################################################
+######Calculate number of clusters
+#On the undirected graph with only direct edges and on the undirected graph with only direct edges shorter cost distance threshold
+cl_no_d <- clusters(g_ud_d)$no
+cl_no_d_cd <- clusters(g_ud_d_cd)$no
+
+cls_size_d <- as.vector(gsummary(groupedData(pop_size ~ 1 | cl, data.frame(cl=clusters(g_ud_d)$membership, pop_size=V(g_ud_d)$pop_proxy), order.groups=TRUE, FUN=sum), sum)$pop_size)
+cls_size_d_cd <- as.vector(gsummary(groupedData(pop_size ~ 1 | cl, data.frame(cl=clusters(g_ud_d_cd)$membership, pop_size=V(g_ud_d_cd)$pop_proxy), order.groups=TRUE, FUN=sum), sum)$pop_size)
+
+cl_max_size_d <- max(cls_size_d)
+cl_max_size_d_cd <- max(cls_size_d_cd)
+
+cl_mean_size_d <- mean(cls_size_d)
+cl_mean_size_d_cd <- mean(cls_size_d_cd)
+
+diam <- diameter(g_ud, directed=FALSE, unconnected=TRUE, weights=E(g_ud)$cd_u)
+diam_d <- diameter(g_ud_d, directed=FALSE, unconnected=TRUE, weights=E(g_ud_d)$cd_u)
+diam_d_cd <- diameter(g_ud_d_cd, directed=FALSE, unconnected=TRUE, weights=E(g_ud_d_cd)$cd_u)
+
+density <- graph.density(g, loops=FALSE)
+density_u <- graph.density(g_ud, loops=FALSE)
+density_ud <- graph.density(g_ud_d, loops=FALSE)
+density_udc <- graph.density(g_ud_d_cd, loops=FALSE)
+
+if (network_overview_ps != "") {
+######Edge removal operations
+idx <- sort(E(g_ud)$cd_u, decreasing=TRUE, na.last=NA, index.return=TRUE)$ix
+cl_del_count <- unlist(mclapply(1:length(idx), function(x) ifelse((clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no/vertices_n)>=convergence_threshold||E(g_ud)$cd_u[idx[x]]<=(connectivity_cutoff+(connectivity_cutoff*0.25)),clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no,NA)))
+cl_del_max_size <- unlist(mclapply(1:length(idx), function(x) ifelse((clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no/vertices_n)>=convergence_threshold||E(g_ud)$cd_u[idx[x]]<=(connectivity_cutoff+(connectivity_cutoff*0.25)),max(as.vector(gsummary(groupedData(pop_size ~ 1 | cl, data.frame(cl=clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$membership, pop_size=V(g_ud)$pop_proxy), order.groups=TRUE, FUN=sum), sum)$pop_size)),NA)))
+cl_del_diam <- unlist(mclapply(1:length(idx), function(x) ifelse((clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no/vertices_n)>=convergence_threshold||E(g_ud)$cd_u[idx[x]]<=(connectivity_cutoff+(connectivity_cutoff*0.25)),diameter(delete.edges(g_ud, E(g_ud)[idx[1:x]]), directed=FALSE, unconnected=TRUE, weights=E(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$cd_u),NA)))
+extract <- sort(grep(FALSE, is.na(cl_del_count)), decreasing=TRUE)
+df_edgeremoval <- data.frame(distance=E(g_ud)$cd_u[((idx[extract]))], cl_del_count=cl_del_count[extract], cl_del_max_size=cl_del_max_size[extract], cl_del_diam=cl_del_diam[extract])
+dist_inv_ix <- sort(df_edgeremoval$distance, decreasing=FALSE, na.last=NA, index.return=TRUE)$ix
+
+ps.options(encoding="CP1257.enc", family="Helvetica", horizontal=FALSE, fonts="Helvetica", paper="a4", pointsize=1/96, height=3.5, width=3.5)
+postscript(network_overview_ps)
+
+###Check axis lables!!!
+matplot(df_edgeremoval$distance/(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), df_edgeremoval$cl_del_count*100/vertices_n, type="l", ylab="", xlab=c("Connectivity threshold", paste("(Cost distance between patches in ", as.character(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), ")", sep="")), lty=1, yaxt="n", yaxs="r", ylim=c(0, 100), yaxs="i", xaxs="i")
+if (connectivity_cutoff>0) abline(v=connectivity_cutoff/10^(nchar(as.integer(max(df_edgeremoval$distance)))-2), col="red", lty=3)
+ifelse(connectivity_cutoff>0, legend("topleft",
+                                     inset=c(0,-0.15), bty = "n", xpd=TRUE,
+                                     c("Clusters (in % of maximum possible clusters)", "Size of the largest cluster (in % of total population size)", "Number of edges (in % of maximum possible number of edges)", "Diameter (in % of diameter of the entire graph)", "Connectivity threshold used in analysis"), lty=c(1, 2, 3, 4, 3), col=c("black", "black", "black", "black", "red"), inset=0.005, bty="o", box.lty=0, bg="White"), legend("topleft", c("Clusters (in % of maximum possible clusters)", "Size of the largest cluster (in % of total population size)", "Number of edges (in % of maximum possible number of edges)", "Diameter (in % of diameter of the entire graph)"), lty=c(1, 2, 3, 4), col=c("black", "black", "black", "black"), inset=0.005, bty="o", box.lty=0, bg="White"))
+axis(2, seq.int(0, 100, 25), labels=c("0 %", "25 %", "50 %", "75 %", "100 %"), yaxs="r")
+matplot(df_edgeremoval$distance/(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), df_edgeremoval$cl_del_max_size*100/sum(V(g)$pop_proxy), type="l", lty=2, yaxt="n", yaxs="i", add=TRUE)
+lines(df_edgeremoval$distance/(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), dist_inv_ix*100/edges_n, type="l", lty=3)
+lines(df_edgeremoval$distance/(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), df_edgeremoval$cl_del_diam*100/diam_d, type="l", lty=4)
+#Lable axis 4!!!
+#axis(4, seq.int(0, 100, 25), yaxs="i", labels=seq.int(0, ceiling((as.integer(edges_n)/(10^(nchar(as.integer(edges_n))-2))))*(10^(nchar(as.integer(edges_n))-2)), ceiling((as.integer(edges_n)/(10^(nchar(as.integer(edges_n))-2))))*(10^(nchar(as.integer(edges_n))-2))/4))
+off <- dev.off(dev.cur())
+
+#idx <- sort(E(g_ud)$cd_u, decreasing=TRUE, na.last=NA, index.return=TRUE)$ix
+#cl_del_count <- unlist(mclapply(1:length(idx), function(x) ifelse((clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no/vertices_n)>=convergence_threshold,clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no,NA)))
+#cl_del_max_size <- unlist(mclapply(1:length(idx), function(x) ifelse((clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no/vertices_n)>=convergence_threshold,max(as.vector(gsummary(groupedData(pop_size ~ 1 | cl, data.frame(cl=clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$membership, pop_size=V(g_ud)$pop_proxy), order.groups=TRUE, FUN=sum), sum)$pop_size)),NA)))
+#cl_del_diam <- unlist(mclapply(1:length(idx), function(x) ifelse((clusters(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$no/vertices_n)>=convergence_threshold,diameter(delete.edges(g_ud, E(g_ud)[idx[1:x]]), directed=FALSE, unconnected=TRUE, weights=E(delete.edges(g_ud, E(g_ud)[idx[1:x]]))$cd_u),NA)))
+#extract <- sort(grep(FALSE, is.na(cl_del_count)), decreasing=TRUE)
+#df_edgeremoval <- data.frame(distance=E(g_ud)$cd_u[((idx[extract]))], cl_del_count=cl_del_count[extract], cl_del_max_size=cl_del_max_size[extract], cl_del_diam=cl_del_diam[extract])
+#dist_inv_ix <- sort(df_edgeremoval$distance, decreasing=FALSE, na.last=NA, index.return=TRUE)$ix
+
+#ps.options(encoding="CP1257.enc", family="Helvetica", horizontal=FALSE, fonts="Helvetica", paper="a4", pointsize=1/96, height=3.5, width=3.5)
+#postscript(network_overview_ps)
+
+####Check axis lables!!!
+#matplot(df_edgeremoval$distance/(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), df_edgeremoval$cl_del_count*100/vertices_n, type="l", xlab=c("Grenseverdi for antatt konnektivitet mellom vernområdene", paste("basert på den funksjonale avstanden mellom dem i ", as.character(10^(nchar(as.integer(max(df_edgeremoval$distance)))-2)), sep="")), ylab="Antall vernområder / nettverkskomponenter", lty=1, yaxt="n", yaxs="r", ylim=c(0, 100), yaxs="i", xaxs="i")
+#if (connectivity_cutoff>0) abline(v=connectivity_cutoff, col="red", lty=3)
+#ifelse(connectivity_cutoff>0, legend("topleft", c("Andel nettverkskomponenter", "Størrelsen av den største nettverkskomponenten", "(i andel populasjons størrelse)", "Antall forbindelser i nettverket", "Andel av diameter av nettverket", "Antatt grenseverdi for konnektivitet"), lty=c(1, 2, 0, 3, 4, 3), col=c("black", "black", "black", "black", "black", "red"), inset=0.005, bty="o", box.lty=0, bg="White"), legend("topleft", c("Andel nettverkskomponenter", "Størrelsen av den største nettverkskomponenten", "(i andel populasjons størrelse)", "Antall forbindelser i nettverket", "Andel av diameter av nettverket"), lty=c(1, 2, 0, 3, 4), col=c("black", "black", "black", "black", "black"), inset=0.005, bty="o", box.lty=0, bg="White"))
+#axis(2, seq.int(0, 100, 25), yaxs="r")
+#matplot(df_edgeremoval$distance, df_edgeremoval$cl_del_max_size*100/sum(V(g)$pop_proxy), type="l", lty=2, yaxt="n", yaxs="i", add=TRUE)
+#lines(df_edgeremoval$distance, dist_inv_ix*100/edges_n, type="l", lty=3)
+#lines(df_edgeremoval$distance, df_edgeremoval$cl_del_diam*100/diam_d, type="l", lty=4)
+##Lable axis 4!!!
+##axis(4, seq.int(0, maks_forbindelser_ud*maks_nodes/maks_forbindelser_ud, 100*maks_nodes/maks_forbindelser_ud), yaxs="i", labels=seq.int(0, maks_forbindelser_ud, 100), ylab="Antall forbindelser")
+#off <- dev.off(dev.cur())
+}
+
+########################################################################
+###Analysis on edge level
+########################################################################
+
+if (verbose) {
+cat("Starting analysis on edge level...\n")
+}
+
+########################################################################
+######Calculate minimum spanning trees (MST) on the undirected graph with only direct edges
+###Minimum spanning tree weighted by maximum potential flow
+
+E(g_ud_d)$mf_mst_ud <- as.integer(0)
+E(g_ud_d)[grep(TRUE, E(g_ud_d)$con_id %in% E(minimum.spanning.tree(g_ud_d, weights=E(g_ud_d)$mf_inv_u))$con_id)]$mf_mst_ud <- 1
+
+###Minimum spanning tree weighted by cost distance
+E(g_ud_d)$cd_mst_ud <- as.integer(0)
+E(g_ud_d)[grep(TRUE, E(g_ud_d)$con_id %in% E(minimum.spanning.tree(g_ud_d, weights=E(g_ud_d)$cd_u))$con_id)]$cd_mst_ud <- 1
+
+E(g_ud_d)$cf_mst_ud <- as.integer(0)
+E(g_ud_d)[grep(TRUE, E(g_ud_d)$con_id %in% E(minimum.spanning.tree(g_ud_d, weights=E(g_ud_d)$cf_inv_u))$con_id)]$cf_mst_ud <- 1
+
+######Calculate minimum spanning trees (MST) on the undirected graph with only direct edges shorter cost distance threshold
+###Minimum spanning tree weighted by maximum potential flow
+E(g_ud_d_cd)$mf_mst_udc <- as.integer(0)
+E(g_ud_d_cd)[grep(TRUE, E(g_ud_d_cd)$con_id %in% E(minimum.spanning.tree(g_ud_d_cd, weights=E(g_ud_d_cd)$mf_inv_u))$con_id)]$mf_mst_udc <- 1
+
+
+###Minimum spanning tree weighted by cost distance
+E(g_ud_d_cd)$cd_mst_udc <- as.integer(0)
+E(g_ud_d_cd)[grep(TRUE, E(g_ud_d_cd)$con_id %in% E(minimum.spanning.tree(g_ud_d_cd, weights=E(g_ud_d_cd)$cd_u))$con_id)]$cd_mst_udc <- 1
+
+###Minimum spanning tree weighted by competing potential flow
+E(g_ud_d_cd)$cf_mst_udc <- as.integer(0)
+E(g_ud_d_cd)[grep(TRUE, E(g_ud_d_cd)$con_id %in% E(minimum.spanning.tree(g_ud_d_cd, weights=E(g_ud_d_cd)$cf_inv_u))$con_id)]$cf_mst_udc <- 1
+
+########################################################################
+###Identify bridges for the undirected graph
+E(g_ud)$is_br_u <- as.integer(unlist(mclapply(1:(length(E(g_ud))), function(x) clusters(delete.edges(g_ud, E(g_ud)[as.integer(x)]))$no-cl_no_d)))
+
+#Identify bridges for the undirected graph with only direct edges
+E(g_ud_d)$is_br_ud <- as.integer(unlist(mclapply(1:(length(E(g_ud_d))), function(x) clusters(delete.edges(g_ud_d, E(g_ud_d)[as.integer(x)]))$no-cl_no_d)))
+
+###Identify bridges for the undirected graph with only direct edges shorter cost distance threshold
+E(g_ud_d_cd)$is_br_udc <- as.integer(unlist(mclapply(1:(length(E(g_ud_d_cd))), function(x) clusters(delete.edges(g_ud_d_cd, E(g_ud_d_cd)[as.integer(x)]))$no-cl_no_d_cd)))
+
+########################################################################
+
+biconnected_components_d <- biconnected.components(g_ud)
+
+#Identify component edges (biconnected components) for the undirected graph with only direct edges
+E(g_ud)$bc_e_u <- as.integer(0)
+for (c in 1:biconnected_components_d$no) {
+E(g_ud)$bc_e_u[unlist(biconnected_components_d$component_edges[c])] <- c
+}
+#Identify tree edges (biconnected components) for the undirected graph with only direct edges
+E(g_ud)$bc_te_u <- as.integer(0)
+for (c in 1:biconnected_components_d$no) {
+E(g_ud)$bc_te_u[unlist(biconnected_components_d$tree_edges[c])] <- c
+}
+
+biconnected_components_d <- biconnected.components(g_ud_d)
+#Identify component edges (biconnected components) for the undirected graph with only direct edges
+E(g_ud_d)$bc_e_ud <- as.integer(0)
+for (c in 1:biconnected_components_d$no) {
+E(g_ud_d)$bc_e_ud[unlist(biconnected_components_d$component_edges[c])] <- c
+}
+#Identify tree edges (biconnected components) for the undirected graph with only direct edges
+E(g_ud_d)$bc_te_ud <- as.integer(0)
+for (c in 1:biconnected_components_d$no) {
+E(g_ud_d)$bc_te_ud[unlist(biconnected_components_d$tree_edges[c])] <- c
+}
+
+biconnected_components_d_cd <- biconnected.components(g_ud_d_cd)
+#Identify component edges (biconnected components) for the undirected graph with only direct edges shorter cost distance threshold
+E(g_ud_d_cd)$bc_e_udc <- as.integer(0)
+for (c in 1:biconnected_components_d_cd$no) {
+E(g_ud_d_cd)$bc_e_udc[unlist(biconnected_components_d_cd$component_edges[c])] <- c
+}
+#Identify tree edges (biconnected components) for the undirected graph with only direct edges shorter cost distance threshold
+E(g_ud_d_cd)$bc_te_udc <- as.integer(0)
+for (c in 1:biconnected_components_d_cd$no) {
+E(g_ud_d_cd)$bc_te_udc[unlist(biconnected_components_d_cd$tree_edges[c])] <- c
+}
+
+########################################################################
+###Calculate edge betweenness
+##Results of the internal edge.betweeness.estimate function are slightly different from the one used here (always larger values):
+##see: E(g_ud_d)$cd_leb_ud <- edge.betweenness.estimate(g_ud_d, e=E(g_ud_d), directed=FALSE, lnbh_cutoff*connectivity_cutoff, weights=E(g_ud_d)$cd_u)
+##But since the internal edge.betweeness.estimate function is not reasonable to use with other weights than cost distance, the workarounds are used nevertheless
+##Further investigation necessary!!!
+
+###Calculate edge betweenness on the entire undirected graph with only direct edges
+
+path_lengths <- shortest.paths(g_ud_d, v=V(g_ud_d), to=V(g_ud_d), weights=E(g_ud_d)$cd_u)
+
+#weighted by cost distance
+E(g_ud_d)$cd_eb_ud <- edge.betweenness(g_ud_d, e=E(g_ud_d), directed=FALSE, weights=E(g_ud_d)$cd_u)
+E(g_ud_d)$cd_leb_ud <- hist(unlist(mclapply(1:length(V(g_ud_d)), function(x) get.shortest.paths(g_ud_d, x,  V(g_ud_d)[grep(TRUE, path_lengths[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d)$cd_u, output=c("epath"))$epath)), breaks=0:(length(E(g_ud_d))), plot=FALSE)$counts/2
+#E(g_ud_d)$cd_leb_ud <- edge.betweenness.estimate(g_ud_d, e=E(g_ud_d), directed=FALSE, lnbh_cutoff*connectivity_cutoff, weights=E(g_ud_d)$cd_u)
+
+#weighted by maximum potential flow
+E(g_ud_d)$mf_eb_ud <- edge.betweenness(g_ud_d, e=E(g_ud_d), directed=FALSE, weights=E(g_ud_d)$mf_inv_u)
+E(g_ud_d)$mf_leb_ud <- hist(unlist(mclapply(1:length(V(g_ud_d)), function(x) get.shortest.paths(g_ud_d, x,  V(g_ud_d)[grep(TRUE, path_lengths[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d)$mf_inv_u, output=c("epath"))$epath)), breaks=0:(length(E(g_ud_d))), plot=FALSE)$counts/2
+
+##weighted by competing potential flow
+E(g_ud_d)$cf_eb_ud <- edge.betweenness(g_ud_d, e=E(g_ud_d), directed=FALSE, weights=E(g_ud_d)$cf_inv_u)
+E(g_ud_d)$cf_leb_ud <- hist(unlist(mclapply(1:length(V(g_ud_d)), function(x) get.shortest.paths(g_ud_d, x,  V(g_ud_d)[grep(TRUE, path_lengths[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d)$cf_inv_u, output=c("epath"))$epath)), breaks=0:(length(E(g_ud_d))), plot=FALSE)$counts/2
+
+########################################################################
+###Calculate edge betweenness on the entire undirected graph with only direct edges shorter cost distance threshold
+
+path_lengths_cd <- shortest.paths(g_ud_d_cd, v=V(g_ud_d_cd), to=V(g_ud_d_cd), weights=E(g_ud_d_cd)$cd_u)
+
+#weighted by cost distance
+E(g_ud_d_cd)$cd_eb_udc <- edge.betweenness(g_ud_d_cd, e=E(g_ud_d_cd), directed=FALSE, weights=E(g_ud_d_cd)$cd_u)
+E(g_ud_d_cd)$cd_leb_udc <- hist(unlist(mclapply(1:length(V(g_ud_d_cd)), function(x) get.shortest.paths(g_ud_d_cd, x,  V(g_ud_d_cd)[grep(TRUE, path_lengths_cd[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d_cd)$cd_u, output=c("epath"))$epath)), breaks=0:(length(E(g_ud_d_cd))), plot=FALSE)$counts/2
+
+
+#weighted by maximum potential flow
+E(g_ud_d_cd)$mf_eb_udc <- edge.betweenness(g_ud_d_cd, e=E(g_ud_d_cd), directed=FALSE, weights=E(g_ud_d_cd)$mf_inv_u)
+E(g_ud_d_cd)$mf_leb_udc <- hist(unlist(mclapply(1:length(V(g_ud_d_cd)), function(x) get.shortest.paths(g_ud_d_cd, x,  V(g_ud_d_cd)[grep(TRUE, path_lengths_cd[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d_cd)$mf_inv_u, output=c("epath"))$epath)), breaks=0:(length(E(g_ud_d_cd))), plot=FALSE)$counts/2
+
+##weighted by competing potential flow
+E(g_ud_d_cd)$cf_eb_udc <- edge.betweenness(g_ud_d_cd, e=E(g_ud_d_cd), directed=FALSE, weights=E(g_ud_d_cd)$cf_inv_u)
+E(g_ud_d_cd)$cf_leb_udc <- hist(unlist(mclapply(1:length(V(g_ud_d_cd)), function(x) get.shortest.paths(g_ud_d_cd, x,  V(g_ud_d_cd)[grep(TRUE, path_lengths_cd[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d_cd)$cf_inv_u, output=c("epath"))$epath)), breaks=0:(length(E(g_ud_d_cd))), plot=FALSE)$counts/2
+
+#########################################################################
+#######Calculate edge betweenness community on the undirected graph
+##weighted by competing potential flow
+ebc <- edge.betweenness.community(g_ud, weights=E(g_ud)$cf_inv_u, directed=FALSE, edge.betweenness=TRUE, merges=TRUE, bridges=TRUE, modularity=TRUE, membership=TRUE)
+
+E(g_ud)$cf_iebc_v <- ebc$edge.betweenness
+#cf_iebc_m <- ebc$merges
+E(g_ud)$cf_iebc_r <- ebc$removed.edges
+E(g_ud)$cf_iebc_b <- unlist(mclapply(1:length(E(g_ud)), function(x) ifelse(x %in% ebc$bridges, 1, 0)))
+E(g_ud)$cf_iebc_c <- crossing(ebc, g_ud)
+
+#V(g)$cf_iebc_mo <- ebc$modularity
+V(g)$cf_iebc_me <- ebc$membership
+
+com_struct <- as.character(cutat(ebc, cl_no_d))
+for (i in (cl_no_d+1):(cl_no_d+cl_thres)) {
+com_struct <- paste(com_struct, cutat(ebc, i), sep=';')
+}
+V(g)$cf_iebc_cs <- as.character(com_struct)
+V(g)$cf_iebc_cl <- cutat(ebc, (cl_no_d+cl_thres))
+
+cf_iebc_u_mod <- modularity(ebc)
+com_no_u <- length(ebc)
+com_sizes_u <- sizes(ebc)
+com_sizes_u_names <- paste("Size of comumity ", names(sizes(ebc)), " (at maximum modularity score (from iebc))", sep="")
+
+#The following workaround was written when igraph did not support weights when calculating edge.betweenness.community
+#The results of this procedure differ significantly from the (new) edge.betweenness.community in igraph 0.6-2 with weights (above)
+#In a first visual the results of the following procedure look more reasonable, but further investigation is necessary!!!
+
+n <- as.integer(1)
+ebc_con_id_u <- as.integer(0)
+ebc_rank <- as.integer(0)
+ebc_value <- as.integer(0)
+ebc_clust <- as.integer(0)
+V(g_ud)$cf_ebc_cs <- as.character(clusters(g_ud)$membership)
+del_eb_g <- g_ud
+
+for (edge in 1:length(E(del_eb_g))) {
+##Recalculate edge betweenness for the remaining edges
+E(del_eb_g)$cf_eb_ud <- edge.betweenness(del_eb_g, e=E(del_eb_g), directed=FALSE, weights=E(del_eb_g)$cf_inv_u)
+##Identify edge with highest edge betweenness value
+idx <- sort.int(E(del_eb_g)$cf_eb_ud, decreasing=TRUE, na.last=NA, index.return=TRUE)$ix[1]
+##Save edge betweenness value for this edge
+ebc_con_id_u[n] <- E(del_eb_g)$con_id_u[idx]
+ebc_rank[n] <- n
+ebc_clust[n] <- clusters(del_eb_g)$no
+if((ebc_clust[n]-cl_no_d)<(cl_no_d+cl_thres)) {if(n>1) {if(ebc_clust[n]>ebc_clust[n-1]) V(g_ud)$cf_ebc_cs <- paste(V(g_ud)$cf_ebc_cs, clusters(del_eb_g)$membership, sep=";")}}
+ebc_value[n] <- E(del_eb_g)$cf_eb_ud[idx]
+##Delete edge with highest edge betweenness value
+del_eb_g <- delete.edges(del_eb_g, E(del_eb_g)[idx])
+n <- n+1
+}
+
+V(g_ud)$cf_ebc_cl <- unlist(mclapply(1:length(V(g_ud)), function(x) strsplit(V(g_ud)$cf_ebc_cs, ";")[[x]][(cl_no_d+cl_thres)]))
+
+#ebc_df <- merge(data.frame(con_id=E(g)$con_id, con_id_u=E(g)$con_id_u), data.frame(con_id_u=ebc_con_id_u, ebc_rank=ebc_rank, ebc_clust=ebc_clust, ebc_value=ebc_value), all.x=TRUE)
+idx <- sort.int(ebc_con_id_u, index.return=TRUE)$ix
+E(g_ud)$cf_ebc_v <- ebc_value[idx]
+E(g_ud)$cf_ebc_r <- ebc_rank[idx]
+E(g_ud)$cf_ebc_c <- ebc_clust[idx]
+
+E(g_ud)$cf_ebc_vi <- strftime(Sys.time()+E(g_ud)$cf_ebc_r)
+########################################################################
+######Calculate cluster membership
+V(g_ud_d)$cl_ud <- clusters(g_ud_d)$membership
+V(g_ud_d_cd)$cl_udc <- clusters(g_ud_d_cd)$membership
+
+#########################################################################
+###Calculate potential cluster connectors (based on cost distance threshold)
+cl_membership <- data.frame(patch_id=V(g_ud_d_cd)$patch_id, cl=V(g_ud_d_cd)$cl_udc)
+cl_pc_pre <- merge(merge(data.frame(id=1:length(E(g)), from_p=E(g)$from_p, to_p=E(g)$to_p), cl_membership, by.x="from_p", by.y="patch_id"),  cl_membership, by.x="to_p", by.y="patch_id")[order(merge(merge(data.frame(id=1:length(E(g)), from_p=E(g)$from_p, to_p=E(g)$to_p), cl_membership, by.x="from_p", by.y="patch_id"),  cl_membership, by.x="to_p", by.y="patch_id")$id) ,]
+E(g)$cl_pc <- ifelse(cl_pc_pre$cl.x==cl_pc_pre$cl.y,0,1)
+
+#########################################################################
+###Calculate community connectors (based on community structure from ebc)
+com_membership <- data.frame(patch_id=V(g_ud_d_cd)$patch_id, com=V(g_ud)$cf_ebc_cl)
+com_pc_pre <- merge(merge(data.frame(id=1:length(E(g)), from_p=E(g)$from_p, to_p=E(g)$to_p), com_membership, by.x="from_p", by.y="patch_id"),  com_membership, by.x="to_p", by.y="patch_id")[order(merge(merge(data.frame(id=1:length(E(g)), from_p=E(g)$from_p, to_p=E(g)$to_p), com_membership, by.x="from_p", by.y="patch_id"),  com_membership, by.x="to_p", by.y="patch_id")$id) ,]
+E(g)$cf_ebc_cc <- ifelse(com_pc_pre$com.x==com_pc_pre$com.y,0,1)
+
+if (verbose) {
+cat("Starting analysis on vertex level...\n")
+}
+
+########################################################################
+###Analysis on vertex level
+########################################################################
+
+########################################################################
+######Calculate degree centrality
+#On the directed graph
+#V(g)$deg_dir <- as.integer(degree(g, v=V(g), mode=c("in")))
+
+#On the entire undirected graph
+V(g_ud)$deg_u <- as.integer(degree(g_ud, v=V(g_ud)))
+
+#On the undirected graph with edges shorter cost distance threshold
+V(g_ud_cd)$deg_uc <- as.integer(degree(g_ud_cd, v=V(g_ud_cd)))
+
+#On the undirected graph with only direct edges
+V(g_ud_d)$deg_ud <- as.integer(degree(g_ud_d, v=V(g_ud_d)))
+
+#On the undirected graph with only direct edges shorter cost distance threshold
+V(g_ud_d_cd)$deg_udc <- as.integer(degree(g_ud_d_cd, v=V(g_ud_d_cd)))
+
+########################################################################
+######Calculate closeness centrality
+V(g_ud_d)$cd_cl_ud <- closeness(g_ud_d, vids=V(g_ud_d), weights = E(g_ud_d)$cd_u, normalized = FALSE)
+V(g_ud_d)$mf_cl_ud <- closeness(g_ud_d, vids=V(g_ud_d), weights = E(g_ud_d)$mf_inv_u, normalized = FALSE)
+V(g_ud_d)$cf_cl_ud <- closeness(g_ud_d, vids=V(g_ud_d), weights = E(g_ud_d)$cf_inv_u, normalized = FALSE)
+
+V(g_ud_d_cd)$cd_cl_udc <- closeness(g_ud_d_cd, vids=V(g_ud_d_cd), weights = E(g_ud_d_cd)$cd_u, normalized = FALSE)
+V(g_ud_d_cd)$mf_cl_udc <- closeness(g_ud_d_cd, vids=V(g_ud_d_cd), weights = E(g_ud_d_cd)$mf_inv_u, normalized = FALSE)
+V(g_ud_d_cd)$cf_cl_udc <- closeness(g_ud_d_cd, vids=V(g_ud_d_cd), weights = E(g_ud_d_cd)$cf_inv_u, normalized = FALSE)
+
+########################################################################
+######Calculate biconnected components
+
+##On the undirected graph with only direct edges
+#Number of new clusters when a vertex is deleted
+V(g_ud_d)$art_ud <- as.integer(unlist(mclapply(1:(length(V(g_ud_d))), function(x) ifelse((clusters(delete.vertices(g_ud_d, V(g_ud_d)[x]))$no-cl_no_d)<0,0,clusters(delete.vertices(g_ud_d, V(g_ud_d)[x]))$no-cl_no_d))))
+#Vertex is articulation point
+V(g_ud_d)$art_p_ud <- as.integer(0)
+V(g_ud_d)$art_p_ud[biconnected_components_d$articulation_points] <- as.integer(1)
+
+##On the undirected graph with only direct edges shorter cost distance threshold
+#Number of new clusters when a vertex is deleted
+V(g_ud_d_cd)$art_udc <- unlist(mclapply(1:(length(V(g_ud_d_cd))), function(x) ifelse((clusters(delete.vertices(g_ud_d_cd, V(g_ud_d_cd)[x]))$no-cl_no_d_cd)<0,0,clusters(delete.vertices(g_ud_d_cd, V(g_ud_d_cd)[x]))$no-cl_no_d_cd)))
+#Vertex is articulation point
+V(g_ud_d_cd)$art_p_udc <- as.integer(0)
+V(g_ud_d_cd)$art_p_udc[biconnected_components_d_cd$articulation_points] <- as.integer(1)
+
+########################################################################
+######Calculate eigenvector centrality
+#Calculate eigenvector for the entire directed graph
+
+#Calculate eigenvector centrality weighted by competing potential flow
+cf_evc_groups <- groupedData(cf ~ 1 | to_p, data=e, FUN=sum)
+cf_evc <- gsummary(cf_evc_groups, sum)
+df_cf_evc_d <- data.frame(patch_id=cf_evc$to_p, cf_evc_d=cf_evc$cf)
+
+#Calculate eigenvector centrality weighted by maximum potential flow
+mf_o_evc_groups <- groupedData(mf_o ~ 1 | to_p, data=e, FUN=sum)
+mf_o_evc <- gsummary(mf_o_evc_groups, sum)
+df_mf_i_evc_d <- data.frame(patch_id=mf_o_evc$to_p, mf_evc_d=mf_o_evc$mf_o)
+
+df_evc_d <- merge(df_cf_evc_d, df_mf_i_evc_d)
+
+######Calculate eigenvector centrality on the directed graph with edges shorter cost distance threshold
+#Calculate eigenvector centrality weighted by competing potential flow
+evc_udc_pre <- data.frame(to_p=e$to_p[grep(TRUE, e$cd_u<connectivity_cutoff)], mf_o=e$mf_o[grep(TRUE, e$cd_u<connectivity_cutoff)], cf=e$cf[grep(TRUE, e$cd_u<connectivity_cutoff)])
+
+cf_evc_udc_groups <- groupedData(cf ~ 1 | to_p, data=evc_udc_pre, FUN=sum)
+cf_evc_udc <- gsummary(cf_evc_udc_groups, sum)
+df_cf_evc_udc <- data.frame(patch_id=cf_evc_udc$to_p, cf_evc=cf_evc_udc$cf)
+
+#Calculate eigenvector centrality weighted by maximum potential flow
+mf_o_evc_udc_groups <- groupedData(mf_o ~ 1 | to_p, data=evc_udc_pre, FUN=sum)
+mf_o_evc_udc <- gsummary(mf_o_evc_udc_groups, sum)
+df_mf_o_evc_udc <- data.frame(patch_id=mf_o_evc_udc$to_p, mf_evc=mf_o_evc_udc$mf_o)
+
+df_evc_cd <- merge(df_cf_evc_udc, df_mf_o_evc_udc)
+
+###Add eigenvector centrality as a vertex attribute
+for (p in 1:length(V(g))) {
+    V(g)$mf_evc_d[p] <- ifelse(length(grep(TRUE, as.integer(as.character(df_evc_d$patch_id))==as.integer(V(g)$patch_id[p])))<1,0,df_evc_d$mf_evc[grep(TRUE, as.integer(as.character(df_evc_d$patch_id))==as.integer(V(g)$patch_id[p]))])
+    V(g)$cf_evc_d[p] <- ifelse(length(grep(TRUE, as.integer(as.character(df_evc_d$patch_id))==as.integer(V(g)$patch_id[p])))<1,0,df_evc_d$cf_evc[grep(TRUE, as.integer(as.character(df_evc_d$patch_id))==as.integer(V(g)$patch_id[p]))])
+    V(g)$mf_evc_cd[p] <- ifelse(length(grep(TRUE, as.integer(as.character(df_evc_cd$patch_id))==as.integer(V(g)$patch_id[p])))<1,0,df_evc_cd$mf_evc[grep(TRUE, as.integer(as.character(df_evc_cd$patch_id))==as.integer(V(g)$patch_id[p]))])
+    V(g)$cf_evc_cd[p] <- ifelse(length(grep(TRUE, as.integer(as.character(df_evc_cd$patch_id))==as.integer(V(g)$patch_id[p])))<1,0,df_evc_cd$cf_evc[grep(TRUE, as.integer(as.character(df_evc_cd$patch_id))==as.integer(V(g)$patch_id[p]))])
+}
+
+
+########################################################################
+###Calculate vertex betweenness
+##Results of the internal betweeness.estimate function are slightly different from the one used here (always larger values)
+##see: V(g_ud_d)$cd_lvb_ud <- betweenness.estimate(g_ud_d, vids = V(g_ud_d), directed = FALSE, lnbh_cutoff*connectivity_cutoff, weights = E(g_ud_d)$cd_u)
+##But since the internal betweeness.estimate function is not reasonable to use with other weights than cost distance, the workarounds are used nevertheless
+##Further investigation necessary!!!
+
+###Calculate vertex betweenness on the undirected graph with only direct edges
+V(g_ud_d)$cd_vb_ud <- betweenness(g_ud_d, v=V(g_ud_d), directed = FALSE, weights = E(g_ud_d)$cd_u)
+vsp_cd_ud <- function(x) unlist(get.shortest.paths(g_ud_d, x,  V(g_ud_d)[grep(TRUE, path_lengths[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d)$cd_u, output=c("vpath"))$vpath)
+V(g_ud_d)$cd_lvb_ud <- hist(unlist(mclapply(1:length(V(g_ud_d)), function(x) vsp_cd_ud(x)[grep(FALSE, 1:length(vsp_cd_ud(x)) %in% append(c(1, length(vsp_cd_ud(x))), append(grep(TRUE, vsp_cd_ud(x)[1:length(vsp_cd_ud(x))]==x), grep(TRUE, vsp_cd_ud(x)[1:length(vsp_cd_ud(x))]==x)-1)))])), breaks=0:length(V(g_ud_d)), plot=FALSE)$counts/2
+
+##weighted by maximum potential flow
+V(g_ud_d)$mf_vb_ud <- betweenness(g_ud_d, v=V(g_ud_d), directed = TRUE, weights = E(g_ud_d)$mf_inv_u)
+vsp_mf_u <- function(x) unlist(get.shortest.paths(g_ud_d, x,  V(g_ud_d)[grep(TRUE, path_lengths[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d)$mf_inv_u, output=c("vpath"))$vpath)
+V(g_ud_d)$mf_lvb_ud <- hist(unlist(mclapply(1:length(V(g_ud_d)), function(x) vsp_mf_u(x)[grep(FALSE, 1:length(vsp_mf_u(x)) %in% append(c(1, length(vsp_mf_u(x))), append(grep(TRUE, vsp_mf_u(x)[1:length(vsp_mf_u(x))]==x), grep(TRUE, vsp_mf_u(x)[1:length(vsp_mf_u(x))]==x)-1)))])), breaks=0:length(V(g_ud_d)), plot=FALSE)$counts/2
+
+##weighted by competing potential flow
+V(g_ud_d)$cf_vb_ud <- betweenness(g_ud_d, v=V(g_ud_d), directed = TRUE, weights = E(g_ud_d)$cf_inv_u)
+vsp_cf_u <- function(x) unlist(get.shortest.paths(g_ud_d, x,  V(g_ud_d)[grep(TRUE, path_lengths[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d)$cf_inv_u, output=c("vpath"))$vpath)
+V(g_ud_d)$cf_lvb_ud <- hist(unlist(mclapply(1:length(V(g_ud_d)), function(x) vsp_cf_u(x)[grep(FALSE, 1:length(vsp_cf_u(x)) %in% append(c(1, length(vsp_cf_u(x))), append(grep(TRUE, vsp_cf_u(x)[1:length(vsp_cf_u(x))]==x), grep(TRUE, vsp_cf_u(x)[1:length(vsp_cf_u(x))]==x)-1)))])), breaks=0:length(V(g_ud_d)), plot=FALSE)$counts/2
+
+###Calculate vertex betweenness on the undirected graph with only direct edges shorter connectivity cutoff
+V(g_ud_d_cd)$cd_vb_udc <- betweenness(g_ud_d_cd, v=V(g_ud_d_cd), directed = FALSE, weights = E(g_ud_d_cd)$cd_u)
+vsp_cd_udc <- function(x) unlist(get.shortest.paths(g_ud_d_cd, x,  V(g_ud_d_cd)[grep(TRUE, path_lengths_cd[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d_cd)$cd_u, output=c("vpath"))$vpath)
+V(g_ud_d_cd)$cd_lvb_udc <- hist(unlist(mclapply(1:length(V(g_ud_d_cd)), function(x) vsp_cd_udc(x)[grep(FALSE, 1:length(vsp_cd_udc(x)) %in% append(c(1, length(vsp_cd_udc(x))), append(grep(TRUE, vsp_cd_udc(x)[1:length(vsp_cd_udc(x))]==x), grep(TRUE, vsp_cd_udc(x)[1:length(vsp_cd_udc(x))]==x)-1)))])), breaks=0:length(V(g_ud_d_cd)), plot=FALSE)$counts/2
+
+##weighted by maximum potential flow
+V(g_ud_d_cd)$mf_vb_udc <- betweenness(g_ud_d_cd, v=V(g_ud_d_cd), directed = TRUE, weights = E(g_ud_d_cd)$mf_i_inv_ud)
+vsp_mf_uc <- function(x) unlist(get.shortest.paths(g_ud_d_cd, x,  V(g_ud_d_cd)[grep(TRUE, path_lengths_cd[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d_cd)$mf_inv_u, output=c("vpath"))$vpath)
+V(g_ud_d_cd)$mf_lvb_udc <- hist(unlist(mclapply(1:length(V(g_ud_d_cd)), function(x) vsp_mf_uc(x)[grep(FALSE, 1:length(vsp_mf_uc(x)) %in% append(c(1, length(vsp_mf_uc(x))), append(grep(TRUE, vsp_mf_uc(x)[1:length(vsp_mf_uc(x))]==x), grep(TRUE, vsp_mf_uc(x)[1:length(vsp_mf_uc(x))]==x)-1)))])), breaks=0:length(V(g_ud_d_cd)), plot=FALSE)$counts/2
+
+##weighted by competing potential flow
+V(g_ud_d_cd)$cf_vb_udc <- betweenness(g_ud_d_cd, v=V(g_ud_d_cd), directed = TRUE, weights = E(g_ud_d_cd)$cf_inv_u)
+vsp_cf_uc <- function(x) unlist(get.shortest.paths(g_ud_d_cd, x,  V(g_ud_d_cd)[grep(TRUE, path_lengths_cd[x,]<(lnbh_cutoff*connectivity_cutoff))], weights=E(g_ud_d_cd)$cf_inv_u, output=c("vpath"))$vpath)
+V(g_ud_d_cd)$cf_lvb_udc <- hist(unlist(mclapply(1:length(V(g_ud_d_cd)), function(x) vsp_cf_uc(x)[grep(FALSE, 1:length(vsp_cf_uc(x)) %in% append(c(1, length(vsp_cf_uc(x))), append(grep(TRUE, vsp_cf_uc(x)[1:length(vsp_cf_uc(x))]==x), grep(TRUE, vsp_cf_uc(x)[1:length(vsp_cf_uc(x))]==x)-1)))])), breaks=0:length(V(g_ud_d_cd)), plot=FALSE)$counts/2
+
+########################################################################
+###Calculate neighborhood size
+V(g_ud_cd)$nbh_s_uc <- as.integer(neighborhood.size(g_ud_cd, 1, nodes=V(g_ud_cd), mode=c("all")))
+###Calculate local neighborhood size
+V(g_ud_cd)$nbh_sl_uc <- as.integer(neighborhood.size(g_ud_cd, lnbh_cutoff, nodes=V(g_ud_cd), mode=c("all")))
+
+if (db_driver == "sqlite") {
+con <- dbConnect(RSQLite::SQLite(), dbname = db)
+} else {
+con <- dbConnect(PostgreSQL::PostgreSQL(), dbname = db)
+}
+
+##############################################
+#Export network overview measures
+network_overview_measures <- data.frame(measure=c("Command", "Number of vertices", "Number of edges (undirected)", "Number of direct edges (undirected)", "Number of edges shorter than cost distance threshold (undirected)", "Number of direct edges shorter than cost distance threshold (undirected)", "Number of clusters of the entire graph", "Number of clusters of the graph with only edges shorter cost distance threshold", "Size of the largest cluster of the entire graph", "Size of the largest cluster of the graph with only edges shorter cost distance threshold", "Average size of the clusters of the entire graph", "Average size of the clusters of the graph with only edges shorter cost distance threshold", "Diameter of the entire graph (undirected)", "Diameter of the graph with only direct edges (undirected)", "Diameter of the graph with only edges shorter cost distance threshold", "Density of the entire graph (directed)", "Density of the entire graph (undirected)", "Density of the grap
 h with only direct edges (undirected)", "Density of the graph with only edges shorter cost distance threshold", "Modularity (from iebc) of the entire graph (undirected) weighted by cf", "Number of communities (at maximum modularity score (from iebc)) of the entire (undirected) graph weighted by cf", com_sizes_u_names), Value=c(command, vertices_n, edges_n, edges_n_d, edges_n_cd, edges_n_d_cd, cl_no_d, cl_no_d_cd, cl_max_size_d, cl_max_size_d_cd, cl_mean_size_d, cl_mean_size_d_cd, diam, diam_d, diam_d_cd, density, density_u, density_ud, density_udc, cf_iebc_u_mod, com_no_u, com_sizes_u))
+dbWriteTable(con, network_output, network_overview_measures, overwrite=overwrite, row.names=FALSE)
+
+###############################################################
+#####Merge vertexmeasures in a dataframe and save it
+
+###Create initial export data frame
+
+vertex_export_df_ud <- as.data.frame(1:length(V(g_ud)))
+
+####Adjust vertex-attributes first
+
+g_ud <- remove.vertex.attribute(g_ud, "pop_proxy")
+
+vertex_attribute_list <- list.vertex.attributes(g_ud)
+if(length(vertex_attribute_list)>0) {
+    for (vl in vertex_attribute_list) {
+        vertex_export_df_ud <- as.data.frame(cbind(vertex_export_df_ud, get.vertex.attribute(g_ud, vl)))
+    }
+
+    vertex_export_df_ud <- vertex_export_df_ud[2:length(vertex_export_df_ud)]
+    names(vertex_export_df_ud) <- vertex_attribute_list
+}
+
+###Create initial export data frame
+
+vertex_export_df_ud_d <- as.data.frame(1:length(V(g_ud_d)))
+
+####Adjust vertex-attributes first
+
+g_ud_d <- remove.vertex.attribute(g_ud_d, "pop_proxy")
+
+vertex_attribute_list <- list.vertex.attributes(g_ud_d)
+if(length(vertex_attribute_list)>0) {
+    for (vl in vertex_attribute_list) {
+        vertex_export_df_ud_d <- as.data.frame(cbind(vertex_export_df_ud_d, get.vertex.attribute(g_ud_d, vl)))
+    }
+    vertex_export_df_ud_d <- vertex_export_df_ud_d[2:length(vertex_export_df_ud_d)]
+    names(vertex_export_df_ud_d) <- vertex_attribute_list
+}
+
+###Create initial export data frame
+
+vertex_export_df_ud_d_cd <- as.data.frame(1:length(V(g_ud_d_cd)))
+
+####Adjust vertex-attributes first
+
+g_ud_d_cd <- remove.vertex.attribute(g_ud_d_cd, "pop_proxy")
+
+vertex_attribute_list <- list.vertex.attributes(g_ud_d_cd)
+
+if(length(vertex_attribute_list)>0) {
+    for (vl in vertex_attribute_list) {
+        vertex_export_df_ud_d_cd <- as.data.frame(cbind(vertex_export_df_ud_d_cd, get.vertex.attribute(g_ud_d_cd, vl)))
+    }
+    vertex_export_df_ud_d_cd <- vertex_export_df_ud_d_cd[2:length(vertex_export_df_ud_d_cd)]
+    names(vertex_export_df_ud_d_cd) <- vertex_attribute_list
+}
+###Create initial export data frame
+
+vertex_export_df_d <- as.data.frame(1:length(V(g)))
+
+vertex_attribute_list <- list.vertex.attributes(g)
+if(length(vertex_attribute_list)>0) {
+
+    for (vl in vertex_attribute_list) {
+        vertex_export_df_d <- as.data.frame(cbind(vertex_export_df_d, get.vertex.attribute(g, vl)))
+    }
+    vertex_export_df_d <- vertex_export_df_d[2:length(vertex_export_df_d)]
+    names(vertex_export_df_d) <- vertex_attribute_list
+}
+
+vertex_export_df <- merge(merge(merge(vertex_export_df_d, vertex_export_df_ud, by="patch_id"), vertex_export_df_ud_d, by="patch_id"), vertex_export_df_ud_d_cd, by="patch_id")
+
+dbWriteTable(con, vertex_output, vertex_export_df, overwrite=overwrite, row.names=FALSE)
+
+#########################################################################
+
+
+###Create initial export data frame for the undirected graph
+
+edge_export_df_ud <- as.data.frame(E(g_ud)$con_id_u)
+
+####Adjust edge attributes for the undirected graphs first
+g_ud <- remove.edge.attribute(g_ud, "con_id")
+g_ud <- remove.edge.attribute(g_ud, "con_id_u")
+g_ud <- remove.edge.attribute(g_ud, "from_p")
+g_ud <- remove.edge.attribute(g_ud, "from_pop")
+g_ud <- remove.edge.attribute(g_ud, "to_p")
+g_ud <- remove.edge.attribute(g_ud, "to_pop")
+g_ud <- remove.edge.attribute(g_ud, "cost_distance")
+g_ud <- remove.edge.attribute(g_ud, "cd_u")
+g_ud <- remove.edge.attribute(g_ud, "distance_weight_e")
+#g_ud <- remove.edge.attribute(g_ud, "distance_weight_e_ud")
+g_ud <- remove.edge.attribute(g_ud, "mf_o")
+g_ud <- remove.edge.attribute(g_ud, "mf_i")
+g_ud <- remove.edge.attribute(g_ud, "mf_o_inv")
+g_ud <- remove.edge.attribute(g_ud, "mf_i_inv")
+g_ud <- remove.edge.attribute(g_ud, "mf_u")
+g_ud <- remove.edge.attribute(g_ud, "mf_inv_u")
+g_ud <- remove.edge.attribute(g_ud, "cf")
+g_ud <- remove.edge.attribute(g_ud, "cf_inv")
+g_ud <- remove.edge.attribute(g_ud, "cf_u")
+g_ud <- remove.edge.attribute(g_ud, "cf_inv_u")
+
+edge_attribute_list <- list.edge.attributes(g_ud)
+
+if(length(edge_attribute_list )>0) {
+    for (el in edge_attribute_list) {
+        edge_export_df_ud <- as.data.frame(cbind(edge_export_df_ud, get.edge.attribute(g_ud, el)))
+    }
+    names(edge_export_df_ud) <- append("con_id_u", edge_attribute_list)
+}
+
+###Create initial export data frame for the undirected graph with only direct edges
+
+edge_export_df_ud_d <- as.data.frame(E(g_ud_d)$con_id_u)
+
+####Adjust edge attributes for the undirected graph with only direct edges
+g_ud_d <- remove.edge.attribute(g_ud_d, "con_id")
+g_ud_d <- remove.edge.attribute(g_ud_d, "con_id_u")
+g_ud_d <- remove.edge.attribute(g_ud_d, "from_p")
+g_ud_d <- remove.edge.attribute(g_ud_d, "from_pop")
+g_ud_d <- remove.edge.attribute(g_ud_d, "to_p")
+g_ud_d <- remove.edge.attribute(g_ud_d, "to_pop")
+g_ud_d <- remove.edge.attribute(g_ud_d, "cost_distance")
+g_ud_d <- remove.edge.attribute(g_ud_d, "cd_u")
+g_ud_d <- remove.edge.attribute(g_ud_d, "distance_weight_e")
+#g_ud_d <- remove.edge.attribute(g_ud_d, "distance_weight_e_ud")
+g_ud_d <- remove.edge.attribute(g_ud_d, "mf_o")
+g_ud_d <- remove.edge.attribute(g_ud_d, "mf_i")
+g_ud_d <- remove.edge.attribute(g_ud_d, "mf_o_inv")
+g_ud_d <- remove.edge.attribute(g_ud_d, "mf_i_inv")
+g_ud_d <- remove.edge.attribute(g_ud_d, "mf_u")
+g_ud_d <- remove.edge.attribute(g_ud_d, "mf_inv_u")
+g_ud_d <- remove.edge.attribute(g_ud_d, "cf")
+g_ud_d <- remove.edge.attribute(g_ud_d, "cf_inv")
+g_ud_d <- remove.edge.attribute(g_ud_d, "cf_u")
+g_ud_d <- remove.edge.attribute(g_ud_d, "cf_inv_u")
+g_ud_d <- remove.edge.attribute(g_ud_d, "isshort")
+g_ud_d <- remove.edge.attribute(g_ud_d, "isshort_cd")
+g_ud_d <- remove.edge.attribute(g_ud_d, "isshort_mf")
+g_ud_d <- remove.edge.attribute(g_ud_d, "isshort_cf")
+
+edge_attribute_list <- list.edge.attributes(g_ud_d)
+
+if(length(edge_attribute_list )>0) {
+    for (el in edge_attribute_list) {
+        edge_export_df_ud_d <- as.data.frame(cbind(edge_export_df_ud_d, get.edge.attribute(g_ud_d, el)))
+    }
+    names(edge_export_df_ud_d) <- append("con_id_u", edge_attribute_list)
+}
+###Create initial export data frame for the undirected graph with only direct edges
+
+edge_export_df_ud_d_cd <- as.data.frame(E(g_ud_d_cd)$con_id_u)
+
+####Adjust edge attributes for the undirected graph with only direct edges
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "con_id")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "con_id_u")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "from_p")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "from_pop")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "to_p")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "to_pop")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "cost_distance")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "cd_u")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "distance_weight_e")
+#g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "distance_weight_e_ud")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "mf_o")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "mf_i")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "mf_o_inv")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "mf_i_inv")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "mf_u")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "mf_inv_u")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "cf")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "cf_inv")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "cf_u")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "cf_inv_u")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "isshort")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "isshort_cd")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "isshort_mf")
+g_ud_d_cd <- remove.edge.attribute(g_ud_d_cd, "isshort_cf")
+
+
+edge_attribute_list <- list.edge.attributes(g_ud_d_cd)
+
+if(length(edge_attribute_list )>0) {
+    for (el in edge_attribute_list) {
+        edge_export_df_ud_d_cd <- as.data.frame(cbind(edge_export_df_ud_d_cd, get.edge.attribute(g_ud_d_cd, el)))
+    }
+    names(edge_export_df_ud_d_cd) <- append("con_id_u", edge_attribute_list)
+}
+
+
+###Create initial export data frame for the directed graph
+edge_export_df <- as.data.frame(1:length(E(g)))
+
+####Adjust edge attributes for the directed graph first
+
+E(g)$cd <- E(g)$cost_distance
+E(g)$distk <- E(g)$distance_weight_e
+E(g)$distk_u <- E(g)$distance_weight_e_ud
+g <- remove.edge.attribute(g, "distance_weight_e")
+g <- remove.edge.attribute(g, "distance_weight_e_ud")
+g <- remove.edge.attribute(g, "cost_distance")
+
+edge_attribute_list <- list.edge.attributes(g)
+
+if(length(edge_attribute_list )>0) {
+    for (el in edge_attribute_list) {
+        edge_export_df <- as.data.frame(cbind(edge_export_df, get.edge.attribute(g, el)))
+    }
+    names(edge_export_df) <- append("id", edge_attribute_list)
+}
+
+export_df_list <-c("edge_export_df_ud", "edge_export_df_ud_d", "edge_export_df_ud_d_cd")
+for (df in export_df_list) {
+    if(length(names(get(df)))) {
+        edge_export_df_final <- merge(edge_export_df, get(df), all.x=TRUE, by="con_id_u", suffixes=c("_x", "_y"))
+        edge_export_df <- edge_export_df_final
+    }
+}
+
+dbWriteTable(con, edge_output, edge_export_df, overwrite=overwrite, row.names=FALSE)
+
+dbDisconnect(con)
+
+if(qml_directory != '') {
+#########################
+#CREATE .qml-files for edge measures visualistion in QGIS
+
+no_quantile <- 5
+colortable <- c('          <prop k="color" v="215,25,28,255"/>',
+                '          <prop k="color" v="253,174,97,255"/>',
+                '          <prop k="color" v="255,255,191,255"/>',
+                '          <prop k="color" v="166,217,106,255"/>',
+                '          <prop k="color" v="26,150,65,255"/>')
+colortable_bin <- c('          <prop k="color" v="0,0,0,255"/>')
+for (attribute in names(edge_export_df_final)) {
+
+#Skip id and geom columns
+if(attribute %in% c("id", "con_id", "con_id_u", "from_p", "to_p", "WKT", "cf_ebc_vi")) { next }
+
+st_mod <- storage.mode(unlist(edge_export_df_final[grep(1, match(names(edge_export_df_final), attribute))]))
+att_val <- unlist(edge_export_df_final[grep(1, match(names(edge_export_df_final), attribute))])
+
+#Write header
+qml <- c("<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>")
+qml <- append(qml, '<qgis version="1.8" minimumScale="0" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0">')
+qml <- append(qml, '  <transparencyLevelInt>255</transparencyLevelInt>')
+
+if((max(att_val, na.rm=TRUE)-min(att_val, na.rm=TRUE)==1)) {
+
+#More header
+qml <- append(qml, paste('  <renderer-v2 attr="', attribute, '" symbollevels="0" type="categorizedSymbol">', sep=''))
+
+#Categories
+qml <- append(qml, '    <categories>')
+qml <- append(qml, '      <category symbol=\"0\" value=\"1\" label=\"\"/>')
+qml <- append(qml, '    </categories>')
+
+#Write symbols
+qml <- append(qml, '    <symbols>')
+qml <- append(qml, '      <symbol outputUnit="MM" alpha="1" type="line" name="0">')
+qml <- append(qml, '        <layer pass=\"0\" class=\"SimpleLine\" locked=\"0\">')
+qml <- append(qml, '          <prop k=\"capstyle\" v=\"square\"/>')
+qml <- append(qml, colortable_bin)
+qml <- append(qml, '          <prop k=\"customdash\" v=\"5;2\"/>')
+qml <- append(qml, '          <prop k=\"joinstyle\" v=\"bevel\"/>')
+qml <- append(qml, '          <prop k=\"offset\" v=\"0\"/>')
+qml <- append(qml, '          <prop k=\"penstyle\" v=\"solid\"/>')
+qml <- append(qml, '          <prop k=\"use_custom_dash\" v=\"0\"/>')
+qml <- append(qml, '          <prop k=\"width\" v=\"0.26\"/>')
+qml <- append(qml, '        </layer>')
+qml <- append(qml, '      </symbol>')
+}
+else {
+
+attribute_quantile <- quantile(edge_export_df_final[grep(1, match(names(edge_export_df_final), attribute))], probs=seq(0, 1, 1/5), na.rm=TRUE, type=8)
+
+#Write more header
+qml <- append(qml, paste('  <renderer-v2 attr="', attribute, '" symbollevels="1" type="graduatedSymbol">', sep=''))
+
+#Write ranges
+ranges <- character()
+qml <- append(qml, '    <ranges>')
+for (quant in 1:no_quantile) {
+ranges <- append(ranges, paste('      <range symbol="', (quant-1),
+                               '" lower="', attribute_quantile[quant],
+                               '" upper="', attribute_quantile[(quant+1)],
+                               '" label="', round(attribute_quantile[quant], 4),
+                               ' - ', round(attribute_quantile[(quant+1)], 4),
+                               '">', sep=''))
+}
+qml <- append(qml, ranges)
+qml <- append(qml, '    </ranges>')
+
+#Write symbols
+qml <- append(qml, '    <symbols>')
+
+for (quant in 1:no_quantile) {
+qml <- append(qml, paste('      <symbol outputUnit="MM" alpha="1" type="line" name="',
+                         (quant-1), '">',
+                         sep=''))
+qml <- append(qml, paste('        <layer pass=\"',
+                         (quant-1),
+                         '\" class=\"SimpleLine\" locked=\"0\">',
+                         sep=''))
+qml <- append(qml, '          <prop k=\"capstyle\" v=\"square\"/>')
+qml <- append(qml, colortable[quant])
+qml <- append(qml, '          <prop k=\"customdash\" v=\"5;2\"/>')
+qml <- append(qml, '          <prop k=\"joinstyle\" v=\"bevel\"/>')
+qml <- append(qml, '          <prop k=\"offset\" v=\"0\"/>')
+qml <- append(qml, '          <prop k=\"penstyle\" v=\"solid\"/>')
+qml <- append(qml, '          <prop k=\"use_custom_dash\" v=\"0\"/>')
+qml <- append(qml, '          <prop k=\"width\" v=\"0.26\"/>')
+qml <- append(qml, '        </layer>')
+qml <- append(qml, '      </symbol>')
+}
+}
+#Write Footer
+qml <- append(qml, '    </symbols>')
+
+
+qml <- append(qml, '    <source-symbol>')
+qml <- append(qml, '      <symbol outputUnit=\"MM\" alpha=\"1\" type=\"line\" name=\"0\">')
+qml <- append(qml, '        <layer pass=\"0\" class=\"SimpleLine\" locked=\"0\">')
+qml <- append(qml, '          <prop k=\"capstyle\" v=\"square\"/>')
+qml <- append(qml, '          <prop k=\"color\" v=\"161,238,135,255\"/>')
+qml <- append(qml, '          <prop k=\"customdash\" v=\"5;2\"/>')
+qml <- append(qml, '          <prop k=\"joinstyle\" v=\"bevel\"/>')
+qml <- append(qml, '          <prop k=\"offset\" v=\"0\"/>')
+qml <- append(qml, '          <prop k=\"penstyle\" v=\"solid\"/>')
+qml <- append(qml, '          <prop k=\"use_custom_dash\" v=\"0\"/>')
+qml <- append(qml, '          <prop k=\"width\" v=\"0.26\"/>')
+qml <- append(qml, '        </layer>')
+qml <- append(qml, '      </symbol>')
+qml <- append(qml, '    </source-symbol>')
+qml <- append(qml, '    <mode name="quantile"/>')
+qml <- append(qml, '    <rotation field=""/>')
+qml <- append(qml, '    <sizescale field=""/>')
+qml <- append(qml, '  </renderer-v2>')
+qml <- append(qml, '  <customproperties/>')
+qml <- append(qml, paste('  <displayfield>"', attribute, '"</displayfield>', sep=''))
+qml <- append(qml, '  <attributeactions/>')
+qml <- append(qml, '</qgis>')
+
+#Save qml-file
+qml_output <- paste(qml_directory, paste(paste("edge_measures_", attribute, sep=''), "qml", sep='.'), sep="/")
+con_qml <- file(qml_output, open="wt")
+write.table(qml, con_qml, append = FALSE, quote = FALSE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = FALSE, col.names = FALSE)
+close(con_qml)
+}
+}
+
+########################################################################
+#Close R
+########################################################################
+#q()
+"""
+
+    if cores <= 1 or os_type == 'Windows':
+        rscript.replace('mclapply', 'lapply')
+
+    robjects.r(rscript)
+
+    grass.run_command('g.copy', quiet=True,
+                      vector='{},{}'.format(network_map,
+                                            edge_output))
+    grass.run_command('g.copy', quiet=True,
+                      vector='{},{}'.format(in_vertices,
+                                            vertex_output))
+
+    # Use v.db.connect instead of v.db.join (much faster)
+
+    grass.run_command('v.db.join', map=edge_output, column='cat',
+                      other_table=edge_output_tmp,
+                      other_column='con_id', quiet=True)
+    grass.run_command('v.db.join', map=vertex_output, column='cat',
+                      other_table=vertex_output_tmp,
+                      other_column='patch_id', quiet=True)
+
+    update_history = '{}\n{}'.format(net_hist_str,
+                                     os.environ['CMDLINE'])
+
+    grass.run_command('v.support', flags='h', map=vertex_output,
+                      person=os.environ['USER'],
+                      cmdhist=update_history)
+
+    grass.run_command('v.support', flags='h', map=edge_output,
+                      person=os.environ['USER'],
+                      cmdhist=update_history)
+
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    atexit.register(cleanup)
+    sys.exit(main())


Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r.connectivity.network.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_deg_udc.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_deg_udc.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_deg_udc.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_deg_udc.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_deg_udc.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_ebc_udc.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_ebc_udc.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_ebc_udc.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_ebc_udc.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_ebc_udc.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_kernel.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_kernel.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_kernel.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_kernel.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_kernel.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Added: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_overview.png
===================================================================
(Binary files differ)

Index: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_overview.png
===================================================================
--- grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_overview.png	2018-09-12 08:56:31 UTC (rev 73316)
+++ grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_overview.png	2018-09-12 12:01:08 UTC (rev 73317)

Property changes on: grass-addons/grass7/raster/r.connectivity/r.connectivity.network/r_connectivity_network_overview.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property


More information about the grass-commit mailing list