View source: R/graphab_to_igraph.R
graphab_to_igraph | R Documentation |
The function creates a landscape graph from a link set created
with Graphab software or different functions of this package and converts
it into a graph object of class igraph
.
The graph has weighted links and is undirected.
Nodes attributes present in the Graphab project are included, including
connectivity metrics when computed
graphab_to_igraph( proj_name, linkset, nodes = "patches", 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 |
nodes |
A character string indicating whether the nodes of the created
graph are given all the attributes or metrics computed in Graphab or only
those specific to a given graph previously created with
|
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 <- "grphb_ex" linkset <- "lkst1" nodes <- "graph" graph <- graphab_to_igraph(proj_name = proj_name, linkset = "lkst1", nodes = "graph", links = links, 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.