| robustness | R Documentation |
This class is a wrapper for robustness calculation and visualization.
new()robustness$new(
network_list,
remove_strategy = c("edge_rand", "edge_strong", "edge_weak", "node_rand", "node_hub",
"node_degree_high", "node_degree_low")[1],
remove_ratio = seq(0, 1, 0.1),
measure = c("Eff", "Eigen", "Pcr")[1],
run = 10
)network_lista list with multiple networks; all the networks should be trans_network object
created from trans_network class of microeco package.
remove_strategydefault "edge_rand";
edges are randomly removed.
edges are removed in decreasing order of weight.
edges are removed in increasing order of weight.
nodes are removed randomly.
node hubs are randomly removed. The hubs include network hubs and module hubs.
nodes are removed in decreasing order of degree.
nodes are removed in increasing order of degree.
remove_ratiodefault seq(0, 1, 0.1).
measuredefault "Eff"; network robustness measures.
network efficiency. The average efficiency of the network is defined:
Eff = \frac{1}{N(N - 1)} \sum_{i \neq j \in G}\frac{1}{d(i, j)}
where N is the total number of nodes and d(i,j) is the shortest path between node i and node j.
When the weight is found in the edge attributes, d(i,j) denotes the weighted shortest path between node i and node j.
For more details, please read the references <doi: 10.1007/s11704-016-6108-z> and <doi: 10.1038/s41598-020-60298-7>.
natural connectivity <doi: 10.1007/s11704-016-6108-z>. The natural connectivity can be regarded as an average eigenvalue that changes strictly monotonically with the addition or deletion of edges. It is defined:
\bar{\lambda} = \ln(\frac{1}{N} \sum_{i=1}^{N} e^{\lambda~i~})
where \lambda~i~ is the ith eigenvalue of the graph adjacency matrix. The larger the value of \bar{\lambda} is, the more robust the network is.
critical removal fraction of vertices (edges) for the disintegration of networks
<doi: 10.1007/s11704-016-6108-z> <doi: 10.1103/PhysRevE.72.056130>.
This is a robustness measure based on random graph theory.
The critical fraction against random attacks is labeled as P_{c}^r. It is defined:
P_{c}^r = 1 - \frac{1}{\frac{\langle k^2 \rangle}{\langle k \rangle} - 1}
where \langle k \rangle is the average nodal degree of the original network, and \langle k^2 \rangle is the average of square of nodal degree.
rundefault 10. Replication number of simulation for the sampling method; Only available when remove_strategy = "edge_rand", "node_rand" or "node_hub".
res_table and res_summary, stored in the object. The res_table is the original simulation result.
The Mean and SD in res_summary come from the res_table.
tmp <- robustness$new(soil_amp_network, remove_strategy = c("edge_rand"),
measure = c("Eff"), run = 3, remove_ratio = c(0.1, 0.5, 0.9))
plot()Plot the simulation results.
robustness$plot( color_values = RColorBrewer::brewer.pal(8, "Dark2"), show_point = TRUE, point_size = 1, point_alpha = 0.6, show_errorbar = TRUE, errorbar_position = position_dodge(0), errorbar_size = 1, errorbar_width = 0.1, add_fitting = FALSE, ... )
color_valuescolors used for presentation.
show_pointdefault TRUE; whether show the point.
point_sizedefault .3; point size value.
point_alphadefault .6; point alpha value.
show_errorbardefault TRUE; whether show the errorbar by using the SD result.
errorbar_positiondefault position_dodge(0); Position adjustment, either as a string (such as "identity"), or the result of a call to a position adjustment function.
errorbar_sizedefault 1; errorbar size.
errorbar_widthdefault 0.1; errorbar width.
add_fittingdefault FALSE; whether add fitted smooth line. FALSE denotes add line segment among points.
...parameters pass to ggplot2::geom_line (when add_fitting = FALSE) or ggplot2::geom_smooth (when add_fitting = TRUE).
ggplot.
\donttest{
tmp$plot(linewidth = 1)
}
clone()The objects of this class are cloneable with this method.
robustness$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## Method `robustness$new`
## ------------------------------------------------
tmp <- robustness$new(soil_amp_network, remove_strategy = c("edge_rand"),
measure = c("Eff"), run = 3, remove_ratio = c(0.1, 0.5, 0.9))
## ------------------------------------------------
## Method `robustness$plot`
## ------------------------------------------------
tmp$plot(linewidth = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.