View source: R/constructWeights.R
constructWeights | R Documentation |
Function takes a numerical vector of vertices degrees and constructs weights with the rule W_ij = 1 / sqrt(d_i * d_j)
and then the whole matrix is normilized by the maximum.
constructWeights(d, K = NULL)
d |
either one numerical vector or a list of |
K |
number of classes (i.e. datasets, i.e. desired graphs). By default it is length(d).
In length(d) = 1, |
W - a list of K
numeric matrices of the size p
by p
{
K <- 3
p <- 50
n <- 20
data <- generateData_rewire(K = K, p = p, n = n, ncores = 1, verbose = FALSE)
G_list_true <- data$Graphs
true_degrees <- rowSums(G_list_true[[1]])
cut <- sort(true_degrees, decreasing = TRUE)[ceiling(p * 0.03)]
apriori_hubs <- ifelse(true_degrees >= cut, 10, 1)
W <- constructWeights(apriori_hubs, K = K)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.