View source: R/netsummary_plot.R
| netsummary_plot | R Documentation |
Draw a network summary plot proposed by Maugis et al. (2017). To count k-cycles, Alon et al. (1997) is used.
netsummary_plot(
A,
subsample_sizes = NA,
max_cycle_order = 4,
n_rep = NA,
n_subsample_sizes = 11,
alpha = 0.05,
y_max = NA,
save_plot = FALSE,
filename = "myplot.pdf",
width = 7,
height = 5,
max_subsample_size = 250,
...
)
violin_netsummary(A, ...)
Vertex sampling is done by simple random sampling without replacement.
The automatically selected subsample size is capped at max_subsample_size
to limit computation time.
Each violin shows the distribution of the subsampled statistic, and a dot marks the mean.
The following input classes are supported: base::matrix, Matrix::dgCMatrix, igraph::igraph, network::network.
A ggplot object. Printed as a side effect when save_plot = FALSE.
Returns the plot invisibly when save_plot = TRUE.
Maugis et al. (2017). Topology reveals universal features for network comparison. arXiv: 1705.05677
Alon et al. (1997). Finding and counting given length cycles. Algorithmica 17, 209–223 (1997). https://doi.org/10.1007/BF02523189
{
set.seed(2022)
#Generating Erdos-Renyi graph
n <- 400
#igraph object
A <- igraph::sample_gnp(n, 0.05)
netsummary_plot(A)
}
#sparse adjacency matrix
A2 <- igraph::as_adjacency_matrix(A)
netsummary_plot(A2)
#dense adjacency matrix
A2 <- igraph::as_adjacency_matrix(A, sparse = FALSE)
netsummary_plot(A2)
#user-specified n_rep and subsample_sizes
netsummary_plot(A, n_rep = 500, subsample_sizes = 150)
#user-specified alpha
netsummary_plot(A, alpha = 0.1)
#network object
if (requireNamespace("network", quietly = TRUE)) {
A3 <- network::as.network(igraph::as_adjacency_matrix(A, sparse = FALSE))
netsummary_plot(A3)
}
#user-specified max_subsample_size
netsummary_plot(A, max_subsample_size = 100)
#saving the plot with user-specified file name
netsummary_plot(A, save_plot = TRUE,
filename = file.path(tempdir(), "myfig.pdf"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.