R/Path_Strength-Linear.R

Defines functions path_value

path_value <- function(sociomatrix, path = NULL, source = NULL, target = NULL, p_norm = Inf){
  check_input(sociomatrix, path, source, target, p_norm)
  if(p_norm == Inf){ return(peay_path_value(sociomatrix, path, source, target)) }
  if(is.null(path)){
    path <- shortest_path(1/sociomatrix, source, target, p_norm)
  }
  distance_matrix <- 1/sociomatrix
  tie_length <- get_tie_strengths(distance_matrix, path)
  return(1/(sum(tie_length^p_norm)^(1/p_norm)))
}
davidbuch/sconduct documentation built on Aug. 6, 2019, 10:53 a.m.