R/graphlaplacian.R

Defines functions graphlaplacian

graphlaplacian <-
function(A, zeta=0.01){
    if (sum(A != t(A)) > 0){
      stop("This method only works for symmetric A!")
    }
    Adeg = apply(abs(A), 1, sum)   # a p-dim vector
    Adeg[Adeg==0] = 1
    AdegInv = (Adeg + zeta)^(-0.5)
    Lunnorm = diag(Adeg) - A
    Lnorm = diag(AdegInv) %*Cpp% A %*Cpp% diag(AdegInv)
    
    return(list(Lunnorm = Lunnorm, Lnorm = Lnorm))
  }

Try the netgsa package in your browser

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

netgsa documentation built on Nov. 14, 2023, 5:09 p.m.