Learn R Programming

sna (version 0.3)

geodist: Fund the Numbers and Lengths of Geodesics Among Nodes in a Graph

Description

geodist uses a BFS to find the number and lengths of geodesics between all nodes of dat. Where geodesics do not exist, the value in inf.replace is substituted for the distance in question.

Usage

geodist(dat, inf.replace=dim(dat)[2])

Arguments

dat
An adjacency matrix
inf.replace
The value to use for geodesic distances between disconnected nodes; by default, this is equal to one greater than the maximum path length

Value

  • A data frame containing:
  • countsA matrix containing the number of geodesics between each pair of vertices
  • sigmaA matrix containing the geodesic distances between each pair of vertices

Details

This routine is used by a variety of other functions; many of these will allow the user to provide manually precomputed geodist output so as to prevent expensive recomputation. Note that the choice of one greater than the maximum path length for disconnected vertex pairs is non-canonical, and some may prefer to simply treat these as missing values. geodist (without loss of generality) treats all paths as directed, a fact which should be kept in mind when interpreting geodist output.

References

Brandes, U. (2000). ``Faster Evaluation of Shortest-Path Based Centrality Indices.'' Konstanzer Schriften in Mathematik und Informatik, 120.

West, D.B. (1996). Introduction to Graph Theory. Upper Saddle River, N.J.: Prentice Hall.

See Also

component.dist, components

Examples

Run this code
#Find geodesics on a random graph
gd<-geodist(rgraph(15))

#Examine the number of geodesics
gd$counts

#Examine the geodesic distances
gd$gdist

Run the code above in your browser using DataLab