R/balabanID.R

Defines functions balabanID

Documented in balabanID

balabanID <- function(g, dist=NULL) {
  if (class(g)[1] != "graphNEL")
    stop("'g' has to be a 'graphNEL' object")
  stopifnot(.validateGraph(g))

  if (is.null(dist))
    dist <- distanceMatrix(g)

  distdeg <- rowSums(dist)

  n <- nodes(g)
  e <- edges(g)
  .weightedPathSum(e, NULL, function(i, from, to) (1 / sqrt(distdeg[[from]] * distdeg[[to]])))
}

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.