diff --git a/dev/articles/geograph.html b/dev/articles/geograph.html index dd478c6..c1f0c67 100644 --- a/dev/articles/geograph.html +++ b/dev/articles/geograph.html @@ -76,7 +76,7 @@

Thibaut Jombart and Andrea Manica

-

2024-01-10

+

2024-01-18

Source: vignettes/geograph.Rmd
geograph.Rmd
@@ -92,10 +92,10 @@

This document describes the geoGraph package for the R software. geoGraph aims at implementing graph approaches for geographic data. In geoGraph, a given geographic area is -modelled by a fine regular grid, where each vertice has a set of spatial +modeled by a fine regular grid, where each vertex has a set of spatial coordinates and a set of attributes, which can be for instance habitat -descriptors, or the presence/abundance of a given species. ‘Travelling’ -within the geographic area can then be easily modelled as moving between +descriptors, or the presence/abundance of a given species. ‘traveling’ +within the geographic area can then be easily modeled as moving between connected vertices. The cost of moving from one vertex to another can be defined according to attribute values, which allows for instance to define friction routes based on habitat.

@@ -191,16 +191,16 @@

gGraph objects## Number of Edges = 0

The documentation ?gGraph explains the basics about the object’s content. In a nutshell, these objects are spatial grids with -nodes and segments connecting neighbouring nodes, and additional +nodes and segments connecting neighboring nodes, and additional informations on the nodes or on the graph itself. coords is a matrix of longitudes and latitudes of the nodes. nodes.attr is a data.frame storing attributes of the nodes, such as habitat descriptors; each row corresponds to a node of the grid, while each column corresponds to a variable. meta is a list -containing miscellanous informations about the graph itself. There is no -contraint applying to the components of the list, but some typical +containing miscellaneous informations about the graph itself. There is +no constraint applying to the components of the list, but some typical components such as $costs or $colors will be -recognised by certain functions. For instance, you can specify plotting +recognized by certain functions. For instance, you can specify plotting rules for representing a given node attribute by a given color by defining a component $colors. Similarly, you can associate costs to a given node attribute by defining a component @@ -208,7 +208,7 @@

gGraph objectsgGraph objects. For instance, worldgraph.10k is a graph of the world with approximately 10,000 nodes, and only on-land connectivity -(\textit{i.e.no travelling on the seas). ```{r } worldgraph.10k worldgraph.10k@meta ``` Lastly, thegraphcomponent is agraphNEL` +(\textit{i.e.no traveling on the seas). ```{r } worldgraph.10k worldgraph.10k@meta ``` Lastly, thegraphcomponent is agraphNEL` object, which is the standard class for graphs in the graph and RBGL packages. This object contains all information on the connections between nodes, and the weights (costs) of these @@ -237,9 +237,9 @@

gData objects
@@ -300,7 +300,7 @@ 

Importing geographic data

GeoGraphic data consist of a set of locations, possibly accompanied by additional information. For instance, one may want to study the -migrations amongst a set of biological populations with known geographic +migrations among a set of biological populations with known geographic coordinates. In geoGraph, geographic data are stored in gData objects. These objects match locations to the closest nodes on a grid (a gGraph object), and store additional @@ -396,11 +396,11 @@

Importing geographic data

This figure illustrates the matching of original locations (black crosses) to nodes of the grid (red circles). As we can see, an issue -occured for Bordeaux, which has been assigned to a node in the sea (in +occurred for Bordeaux, which has been assigned to a node in the sea (in blue). Locations can be re-assigned to nodes with restrictions for some node attribute values using closestNode; for instance, here we constrain matching nodes to have an habitat value -(defined as node attribute in worldgraph.10k) equalling +(defined as node attribute in worldgraph.10k) equaling land (green points):

 cities <- closestNode(cities, attr.name = "habitat", attr.value = "land")
@@ -532,7 +532,7 @@ 

Zooming in and out, sliding, etc.geo.zoomin can accept an argument specifying a rectangular region, which will be adapted by the function to fit best -a square area with similar position and centre, and zoom to this area +a square area with similar position and center, and zoom to this area (see ?geo.zoomin). geo.bookmark and geo.goto respectively set and go to a bookmark, i.e. a tagged area. This is most useful when one has to switch @@ -595,7 +595,7 @@

Plotting gData objects
@@ -684,10 +684,10 @@ 

Changing the global connec

On this new graph, we represent the edges with a width inversely proportional to the associated cost; that is, bold lines for easy -travelling and light edges/dotted lines for more costly mouvement. This -is not enough yet, since travelling on land is still possible. However, -we can tell geoGraph to remove all edges associated to too -strong a cost, as defined by a given threshold (using +traveling and light edges/dotted lines for more costly movement. This is +not enough yet, since traveling on land is still possible. However, we +can tell geoGraph to remove all edges associated to too strong +a cost, as defined by a given threshold (using dropDeadEdges). Here, only sea-sea connections shall be retained, that is, edges with cost 1.

@@ -696,8 +696,8 @@ 

Changing the global connec

Here we are: newGraph only contains connections in the sea. Note that, although we restrained the plotting area to Madagascar, -this change is effective everywhere. For instance, travelling to the -nort-west Australian coasts:

+this change is effective everywhere. For instance, traveling to the +north-west Australian coasts:

 geo.zoomin(c(110, 130, -27, -12))

@@ -772,10 +772,10 @@

Extracting information from geographic data. For this purpose, we use the function extractFromLayer. geoGraph uses sf objects to represent geographic objects such as points and polygons. By -default, geoGraph uses the package naturalearth to +default, geoGraph uses the package rnaturalearth to provide continent and country outlines, but it is possible also to load custom GIS shapefiles with sf::st_read().

-

We start by loading country oultines for the whole world. Note that +

We start by loading country outlines for the whole world. Note that we turn off spherical trigonometry functions with sf::sf_use_s2(FALSE), as the naturalearth dataset is not compatible with that functionality.

@@ -858,7 +858,7 @@

Extracting information from
 plot(newGraph, col.rules = colMat, reset = TRUE)

-

This information could in turn be used to define costs for travelling +

This information could in turn be used to define costs for traveling on the grid. For instance, one could import habitat descriptors from a GIS, use these values to formulate a habitat model, and derive costs for dispersal on the grid.

@@ -1024,9 +1024,9 @@

Finding least-cost pathstitle("Genetic diversity vs geographic distance \n uniform costs ")

Alternatively, we can use costs based on habitat. As a toy example, -we will consider that coasts are four times more favourable for -dispersal than the rest of the landmasses. We define these new costs, -and then compute and plot the corresponding shortest paths:

+we will consider that coasts are four times more favorable for dispersal +than the rest of the landmasses. We define these new costs, and then +compute and plot the corresponding shortest paths:

 myGraph@meta$costs[7, ] <- c("coast", 0.25)
 myGraph@meta$costs
diff --git a/dev/index.html b/dev/index.html index 52aeee0..e245e79 100644 --- a/dev/index.html +++ b/dev/index.html @@ -72,7 +72,7 @@

-

geoGraph aims at implementing graph approaches for geographic data. In geoGraph, a given geographic area is modelled by a fine regular grid, where each vertex has a set of spatial coordinates and a set of attributes, which can be for instance habitat descriptors, or the presence/abundance of a given species. ‘Travelling’ within the geographic area can then be easily modelled as moving between connected vertices. The cost of moving from one vertex to another can be defined according to attribute values, which allows for instance to define friction routes based on habitat.

+

geoGraph aims at implementing graph approaches for geographic data. In geoGraph, a given geographic area is modeled by a fine regular grid, where each vertex has a set of spatial coordinates and a set of attributes, which can be for instance habitat descriptors, or the presence/abundance of a given species. ‘traveling’ within the geographic area can then be easily modeled as moving between connected vertices. The cost of moving from one vertex to another can be defined according to attribute values, which allows for instance to define friction routes based on habitat.

geoGraph harnesses the full power of graph algorithms implemented in R by the graph and RBGL (R Boost Graph Library) packages. In particular, RBGL is an interface between R and the comprehensive Boost Graph Library in C++, which provides fast and efficient implementations of a wide range of graph algorithms. Once we have defined frictions for an entire geographic area, we can easily, for instance, find the least costs path from one location to another, or find the most parsimonious way of connecting a set of locations.

Interfacing spatial data and graphs can be a complicated task. The purpose of geoGraph is to provide tools to achieve and simplify this ‘preliminary’ step. This is achieved by defining new classes of objects which are essentially geo-referenced graphs with node attributes (gGraph objects), and interfaced spatial data (gData objects).

diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index 382f686..b798f38 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: geograph: geograph.html -last_built: 2024-01-10T09:25Z +last_built: 2024-01-18T17:46Z urls: reference: https://evolecolgroup.github.io/geograph/reference article: https://evolecolgroup.github.io/geograph/articles diff --git a/dev/reference/combineCosts.html b/dev/reference/combineCosts.html index 2a54e04..c1f0a29 100644 --- a/dev/reference/combineCosts.html +++ b/dev/reference/combineCosts.html @@ -72,7 +72,7 @@

Usage

Arguments

x1
-

The firt gGraph (which will be used as a template to build the combined gGraph)

+

The first gGraph (which will be used as a template to build the combined gGraph)

x2
diff --git a/dev/reference/connectivity-2.png b/dev/reference/connectivity-2.png index 87cca1b..d1f204f 100644 Binary files a/dev/reference/connectivity-2.png and b/dev/reference/connectivity-2.png differ diff --git a/dev/reference/connectivity.html b/dev/reference/connectivity.html index 41531d4..ae15377 100644 --- a/dev/reference/connectivity.html +++ b/dev/reference/connectivity.html @@ -153,7 +153,7 @@

Details

connectivityPlot: plots connected sets of a gGraph or a gData object with different colors.

In connectivityPlot, isolated nodes (i.e. belonging to no connected -set of size > 1) are plotted in light grey.

+set of size > 1) are plotted in light gray.

diff --git a/dev/reference/extractFromLayer.html b/dev/reference/extractFromLayer.html index d0b24cd..cca8d76 100644 --- a/dev/reference/extractFromLayer.html +++ b/dev/reference/extractFromLayer.html @@ -92,7 +92,7 @@

ArgumentsFind which nodes are on land — findLand • geoGraph