View source: R/compute_distance.R
| compute_distance | R Documentation |
This function calculates the Manhattan norm (L1 norm) distance between two adjacency matrices representing brain networks.
compute_distance(G, M)
G |
A square adjacency matrix representing a brain network. |
M |
A square adjacency matrix representing the central brain network. |
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.
A numeric value representing the Manhattan distance between G and M.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.