R/frag.path.lengths.R

Defines functions frag.path.lengths

Documented in frag.path.lengths

frag.path.lengths <- function(graph, cumulative=FALSE){
  # tests:
  .check.frag.graph(graph)
  # main function:  
  if(! is.logical(cumulative)) stop("The 'cumulative' parameter requires a logical value.")
  
  path.vector <- igraph::distance_table(graph, directed = FALSE)$res
  
  if(cumulative){
    path.vector <- path.vector / max(path.vector)
  }
  path.vector
}

Try the archeofrag package in your browser

Any scripts or data that you put into this service are public.

archeofrag documentation built on Sept. 12, 2022, 1:06 a.m.