R/geometricArithmetic2.R

Defines functions geometricArithmetic2

Documented in geometricArithmetic2

geometricArithmetic2 <- 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)

  sum(.edgeApply(g, function(i, j) {
    to_i <- dist[, i]
    to_j <- dist[, j]
    n_i <- sum(to_i < to_j)
    n_j <- sum(to_i > to_j)
    2 * sqrt(n_i * n_j) / (n_i + n_j)
  }, dupls=FALSE))
}

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.