network_overlap: Calculate and present shared vertices and edges among...

View source: R/network-overlap.R

network_overlapR Documentation

Calculate and present shared vertices and edges among networks

Description

network_overlap() treats edges as undirected, collapses reciprocal and duplicate adjacency-list entries, and compares the resulting exact edge and vertex sets. Curated, experimental, and computational networks may have low exact overlap because each contains false-positive edges and misses real interactions. Overlap is therefore a structural comparison, not an absolute performance measure; use nea_member_recovery_benchmark() for pathway-member recovery. The function draws Venn diagrams for up to five networks by default and switches to UpSet-style plots for larger comparisons. Venn panels use expanded side margins and adaptive text for long names. Network labels include the corresponding total numbers of vertices or edges.

Usage

network_overlap(
  networks,
  plot = TRUE,
  plot_type = c("auto", "venn", "upset", "both"),
  max_intersections = 30L,
  case_sensitive = FALSE,
  colors = "style",
  opacity = 0.3,
  normalize = FALSE
)

Arguments

networks

Named list containing two or more networks. Each network may be an undirected igraph, a legacy named adjacency list with links and Ntotal, or an indexed network created internally by NEArender.

plot

Draw the vertex and edge overlap plots.

plot_type

One of "auto", "venn", "upset", or "both". Automatic mode uses Venn diagrams for at most five networks and UpSet-style plots for more. "both" draws Venn diagrams on the first page and UpSet-style plots on the second. Venn output supports at most seven networks.

max_intersections

Maximum number of observed intersections shown in each UpSet-style plot. All observed intersections are still returned as tables.

case_sensitive

Identifier case policy used when normalize = TRUE.

colors

Colors passed to venn::venn() as its zcolor argument.

opacity

Venn region opacity between zero and one.

normalize

Re-normalize network node identifiers. The default is FALSE because networks are normally normalized during import. Enabling this option warns because it copies and processes the full adjacency data.

Value

Invisibly, a list with per-network summaries and exact vertex and edge sets, intersection tables, and intersection members. In an intersection pattern, positions correspond to names(networks) and 1 denotes membership.

See Also

nea_member_recovery_benchmark(), node_degrees(), topology_2nd()

Examples

first <- list(links = list(a = "b", b = c("a", "c"), c = "b"),
  Ntotal = 2)
second <- list(links = list(b = "c", c = c("b", "d"), d = "c"),
  Ntotal = 2)
overlap <- network_overlap(list(first = first, second = second), plot = FALSE)
overlap$vertices$table

NEArender documentation built on Nov. 28, 2026, 5:10 p.m.