centrality_bridge_plot: Bridge Centrality Plot

View source: R/centrality_bridge_plot.R

centrality_bridge_plotR Documentation

Bridge Centrality Plot

Description

Creates a comparative bridge centrality plot for two groups.

Usage

centrality_bridge_plot(
  networks_groups,
  group_names = c("Mujer", "Varón"),
  measure = "Bridge Expected Influence (1-step)",
  color_palette = c("#FF5733", "#33FFCE"),
  communities = NULL
)

Arguments

networks_groups

Named list of network objects by group.

group_names

Character vector of length 2 with group names.

measure

Bridge centrality measure name.

color_palette

Character vector of 2 colors for the groups.

communities

Community membership vector for bridge calculation.

Value

A list with table (a data frame with the bridge centrality of each node in each group, raw and as z-scores) and plot (a ggplot object).

Examples

set.seed(123)
n <- 300
f1 <- rnorm(n)
f2 <- 0.3 * f1 + rnorm(n)
items <- data.frame(
  sapply(1:4, function(i) 0.7 * f1 + rnorm(n, 0, 0.7)),
  sapply(1:4, function(i) 0.7 * f2 + rnorm(n, 0, 0.7))
)
names(items) <- c(paste0("A", 1:4), paste0("B", 1:4))
items$sex <- rep(c("Female", "Male"), each = n / 2)

nets <- estimate_networks_by_group(items, group_var = "sex",
                                   columns = names(items)[1:8],
                                   default = "EBICglasso")
res <- centrality_bridge_plot(nets, group_names = c("Female", "Male"),
                              communities = rep(c("A", "B"), each = 4))
res$plot

InterconectaR documentation built on Oct. 16, 2026, 1:06 a.m.