R/laplacianEnergy.R

Defines functions laplacianEnergy

Documented in laplacianEnergy

laplacianEnergy <- function(g) {

  if (class(g)[1] != "graphNEL")
    stop("'g' must be a 'graphNEL' object")
  stopifnot(.validateGraph(g))
  
  n <- numNodes(g)
  m <- numEdges(g)

  lap <- laplaceMatrix(g)
  EV <- as.double(eigen(lap, only.values=TRUE)$values)
  sum(abs(EV - 2*m/n))
}

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.