R/bonchev2.R

Defines functions bonchev2

Documented in bonchev2

bonchev2 <- function(g, dist=NULL, wien=NULL){
  if(class(g)[1]!="graphNEL"){
    stop("'g' must be a 'graphNEL' object")
  }
  if(is.null(wien)){
    wien <- wiener(g)
  }
  if(is.null(dist)){
    dist <- distanceMatrix(g)
  }

  rho <- max(dist)
  ki <- table(dist)[2:(rho+1)]
  i <- as.numeric(names(ki))
  In <- i*ki * log2(i)

  wien*log2(wien)-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, 5:46 p.m.