Compare Two Networks
compare_networks.Rd
This function compares two networks using summary metrics, degree distributions, and topological similarity measures. It overlays the complementary cumulative frequency distributions (CCDFs) of degree and returns a combined report.
Arguments
- graph1
An igraph object or data.frame (edge list).
- graph2
An igraph object or data.frame (edge list).
- remove_singles
Logical; remove single nodes before analysis.
- show_PL
Logical; whether to fit and display power law exponents.
- PL_exponents
Vector; power-law slopes to show.
- colors
Optional vector of colors for the CCDF plot.
- label.size
Labels' size in the CCDF plot.
Value
A list with:
metrics1: Summary metrics for graph1
metrics2: Summary metrics for graph2
CCDF_plot: ggplot overlay of ccdfs
jaccard_similarity: Jaccard index of edge sets
node_overlap: Fraction of shared nodes
edge_overlap: Fraction of shared edges
ks_test: KS test result for degree distributions
Examples
if (FALSE) { # \dontrun{
library(igraph)
g1 <- sample_pa(100)
g2 <- sample_gnp(100, 0.05, directed = F)
compare_networks(g1, g2)
} # }