compute_edge_frequencies: Compute Edge Frequencies in Populations

View source: R/compute_edge_frequencies.R

compute_edge_frequenciesR Documentation

Compute Edge Frequencies in Populations

Description

This function computes the frequency of each edge (connection between nodes) across all graphs within each population.

Usage

compute_edge_frequencies(populations)

Arguments

populations

A list where each element is a population containing a list of graphs (adjacency matrices).

Value

A list containing edge counts and edge proportions for each population.

Examples

# Generate synthetic populations
control_graphs <- generate_category_graphs(
  n_graphs = 5,
  n_nodes = 10,
  n_communities = 2,
  base_intra_prob = 0.8,
  base_inter_prob = 0.2,
  seed = 1
)
patient_graphs <- generate_category_graphs(
  n_graphs = 5,
  n_nodes = 10,
  n_communities = 2,
  base_intra_prob = 0.6,
  base_inter_prob = 0.4,
  seed = 2
)
populations <- list(Control = control_graphs, Patient = patient_graphs)

# Compute edge frequencies
frequencies <- compute_edge_frequencies(populations)
# View edge counts for the first population
edge_counts_control <- frequencies$edge_counts[,,1]
print(edge_counts_control)

BrainNetTest documentation built on Dec. 3, 2026, 5:08 p.m.