compute_distance: Compute the Manhattan Norm Distance Between Two Graphs

View source: R/compute_distance.R

compute_distanceR Documentation

Compute the Manhattan Norm Distance Between Two Graphs

Description

This function calculates the Manhattan norm (L1 norm) distance between two adjacency matrices representing brain networks.

Usage

compute_distance(G, M)

Arguments

G

A square adjacency matrix representing a brain network.

M

A square adjacency matrix representing the central brain network.

Details

The distance is sum(abs(G - M)) over all matrix entries. For symmetric matrices with zero diagonal, each undirected edge is counted twice. This convention also sets the scale of the reported T statistic; using only the upper triangle would divide both values by two.

Value

A numeric value representing the Manhattan distance between G and M.

Examples

# Generate synthetic data
G1 <- generate_random_graph(n_nodes = 5, edge_prob = 0.1)
G2 <- generate_random_graph(n_nodes = 5, edge_prob = 0.1)
central_graph <- compute_central_graph(list(G1, G2))
distance <- compute_distance(G1, central_graph)

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