geodesic {ergmito}R Documentation

Geodesic distance matrix (all pairs)

Description

Calculates the shortest path between all pairs of vertices in a network. This uses the power matrices to do so, which makes it efficient only for small networks.

Usage

geodesic(x, force = FALSE, ...)

geodesita(x, force = FALSE, ...)

## S3 method for class 'matrix'
geodesic(x, force = FALSE, simplify = FALSE, ...)

## S3 method for class 'network'
geodesic(x, force = FALSE, simplify = FALSE, ...)

Arguments

x

Either a list of networks (or square integer matrices), an integer matrix, a network, or an ergmito.

force

Logical scalar. If force = FALSE (the default) and nvertex(x) > 100 it returns with an error. To force computation use force = TRUE.

...

Further arguments passed to the method.

simplify

Logical scalar. When TRUE it returns a matrix, otherwise, a list of length nnets(x).

Examples

data(fivenets)
geodesic(fivenets)

# Comparing with sna
if (require("sna")) {
  net0 <- fivenets[[1]]
  net  <- network::network(fivenets[[1]])
  benchmarkito(
    ergmito = ergmito::geodesic(net0),
    sna     = sna::geodist(net), times = 1000
  )
}

[Package ergmito version 0.3-1 Index]