geodist {sna} | R Documentation

## 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=Inf)

### Arguments

`dat` | one or more input graphs.
`inf.replace` | the value to use for geodesic distances between disconnected nodes; by default, this is equal `Inf`.

### 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 (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.

### Value

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

### Note

`geodist` implicitly treats graphs as unvalued; as such, reported distances may not be correct if all edge weights are non-identical.

### Author(s)

Carter T. Butts buttsc@uci.edu

### 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

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

    #Examine the number of geodesics
    gd$counts

    #Examine the geodesic distances
    gd$gdist

[Package sna version 1.1 Index]