Learn R Programming

ldstatsHD (version 1.0.1)

harmMeanDist: Harmonic mean of network distances

Description

Finds the harmonic mean of the geodesic distances between nodes in a graph.

Usage

harmMeanDist(A, nodesDegree = NULL)

Arguments

A

matrix or Matrix object with adjacency matrix of a graph.

nodesDegree

vector with nodes degree (in case it is been previously calculated).

Value

The harmonic mean value.

Details

The geodesic distance \(d_{ij}\) between two nodes \(i\) and \(j\) of a graph is given by the shortest number of edges so that we can go from one of the nodes to the other. Then, the harmonic mean of these distances is given by $$ \bar{d} = [p(p-1)/(2\sum_{i<j} d_{ij})]^{-1}. $$

References

Costa, L. and F. Rodrigues (2007). Characterization of complex networks: A survey of measurements. Advances in Physics 56(1), 167-242.

See Also

lambdaSelection for lambda selection approaches.

Examples

Run this code
# NOT RUN {
# example to use of harmonic mean function
EX1         <- pcorSimulator(nobs = 50, nclusters = 2, nnodesxcluster = c(40,30), 
                             pattern = "powerLaw")
y           <- EX1$y
out3        <- huge(y, method = "mb", lambda = 0.4)
PATH        <- out3$path[[1]]
hm          <- harmMeanDist(PATH)
  
 
# }

Run the code above in your browser using DataLab