R/bonchev1.R

Defines functions bonchev1

Documented in bonchev1

bonchev1 <- function(g,dist=NULL){
  if(class(g)[1]!="graphNEL"){
    stop("'g' must be a 'graphNEL' object")
  }
  stopifnot(.validateGraph(g))
  
  if(is.null(dist)){
    dist <- distanceMatrix(g)
  }
  rho <- max(dist)
  ki <- table(dist)[2:(rho+1)]
  nV <- numNodes(g)
  pis <- 2*ki/nV^2
  In <- (pis*log2(pis))
  return (((-1)/nV)*log2(1/nV)-sum(In))
}

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, 8:18 a.m.