graph_plot_compar {graph4lg} | R Documentation |
Visualize the topological differences between two spatial graphs on a map
Description
The function enables to compare two spatial graphs by plotting them highlighting the topological similarities and differences between them. Both graphs should share the same nodes and cannot be directed graphs.
Usage
graph_plot_compar(x, y, crds)
Arguments
x |
A graph object of class |
y |
A graph object of class |
crds |
A
|
Details
The graphs x
and y
of class igraph
must have
node names (not necessarily in the same order as IDs in crds,
given a merging is done).
Value
A ggplot2 object to plot
Author(s)
P. Savary
Examples
data(pts_pop_ex)
data(data_ex_genind)
mat_w <- mat_gen_dist(data_ex_genind, dist = "DPS")
mat_dist <- mat_geo_dist(data = pts_pop_ex,
ID = "ID",
x = "x",
y = "y")
mat_dist <- mat_dist[order(as.character(row.names(mat_dist))),
order(as.character(colnames(mat_dist)))]
g1 <- gen_graph_topo(mat_w = mat_w, topo = "mst")
g2 <- gen_graph_topo(mat_w = mat_w, mat_topo = mat_dist, topo = "gabriel")
g <- graph_plot_compar(x = g1, y = g2,
crds = pts_pop_ex)