# Distance (aka p norm) -----------------------------------------------------
set.seed(123)
G <- rgraph_ws(20, 4, .1)
X <- matrix(runif(40), ncol=2)
vertex_covariate_dist(G, X)[1:5, 1:5]
# Mahalanobis distance ------------------------------------------------------
S <- var(X)
M <- vertex_mahalanobis_dist(G, X, S)
# Example with diffnet objects ----------------------------------------------
data(medInnovationsDiffNet)
X <- cbind(
medInnovationsDiffNet[["proage"]],
medInnovationsDiffNet[["attend"]]
)
S <- var(X, na.rm=TRUE)
ans <- vertex_mahalanobis_dist(medInnovationsDiffNet, X, S)
Run the code above in your browser using DataLab