View source: R/graphab_to_igraph.R
| graphab_to_igraph | R Documentation |
The function creates a landscape graph from a link set and a
set of habitat patches created with Graphab and converts it into a graph
object of class igraph. The graph has weighted links and
is undirected. Nodes attributes present in the habitat layer created with
Graphab project are included, including connectivity metrics when computed.
graphab_to_igraph(
proj_name,
linkset,
habitat,
nodes = NULL,
weight = "cost",
proj_path = NULL,
fig = FALSE,
crds = FALSE
)
proj_name |
A character string indicating the project name. It is also the name of the directory in which proj_name.xml file is found. By default, 'proj_name' is searched into the current working directory |
linkset |
A character string indicating the name of the linkset used to
create the graph links. The linkset must have been created previously (see
the function |
habitat |
A character string indicating the name of a habitat type created in the Graphab project. |
nodes |
Deprecated parameter from graph4lg < 2.0. |
weight |
A character string ("euclid" or "cost") indicating whether to weight the links with Euclidean distance or cost-distance (default) values. |
proj_path |
(optional) A character string indicating the path to the directory that contains the project directory ('proj_name'). By default, 'proj_name' is searched into the current working directory |
fig |
Logical (default = FALSE) indicating whether to plot a figure of
the resulting spatial graph. The figure is plotted using function
|
crds |
Logical (default = FALSE) indicating whether to create an object
of class |
A graph object of class igraph (if crds = FALSE) or a
list of objects: a graph object of class igraph and a
data.frame with the nodes spatial coordinates (if crds = TRUE).
P. Savary
foltete2012softwaregraph4lg
## Not run:
proj_path <- system.file('extdata', package = 'graph4lg')
proj_name <- "graphab_example"
linkset <- "forest_link_planar"
habitat <- "forest"
graph <- graphab_to_igraph(proj_name = proj_name,
linkset = linkset,
habitat = habitat,
weights = "cost",
proj_path = proj_path,
crds = FALSE,
fig = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.