geodist {sna} | R Documentation |
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.
geodist(dat, inf.replace=dim(dat)[2])
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 |
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.
A data frame containing:
counts |
A matrix containing the number of geodesics between each pair of vertices |
sigma |
A matrix containing the geodesic distances between each pair of vertices |
Carter T. Butts buttsc@uci.edu
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.
#Find geodesics on a random graph gd<-geodist(rgraph(15)) #Examine the number of geodesics gd$counts #Examine the geodesic distances gd$gdist