R/layerMatrix.R

Defines functions layerMatrix

Documented in layerMatrix

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

  diam <- max(dist)
  t(sapply(nodes(g), function(v) {
    tabulate(dist[v,], nbins=diam)
  }))
}

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.