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=Inf)
dat |
one or more input graphs. |
inf.replace |
the value to use for geodesic distances between disconnected nodes; by default, this is equal Inf . |
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 (albeit common), 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 list 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 |
geodist
implicitly treats graphs as unvalued; as such, reported distances may not be correct if all edge weights are non-identical.
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