R/vertConnectMatrix.R

Defines functions vertConnectMatrix

Documented in vertConnectMatrix

vertConnectMatrix <- function(g) {
  stopifnot(.validateGraph(g))
  adj.mat <- adjacencyMatrix(g)
  n_nodes <- nrow(adj.mat)
  VerCon_Mat <- matrix(0, nrow=n_nodes, ncol=n_nodes, byrow=TRUE)
  deg.vec <- graph::degree(g) 
  for(i in 1:n_nodes) {
    for(j in 1:n_nodes) {
      if(adj.mat[i,j] != 0) {
        VerCon_Mat[i,j] <- 1/(sqrt(deg.vec[i]*deg.vec[j]))
      }
    }
  }
  VerCon_Mat
}

Try the QuACN package in your browser

Any scripts or data that you put into this service are public.

QuACN documentation built on May 2, 2019, 5:46 p.m.