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.
geodesic(x, force = FALSE, ...) geodesita(x, force = FALSE, ...) # S3 method for matrix geodesic(x, force = FALSE, simplify = FALSE, ...) # S3 method for network geodesic(x, force = FALSE, simplify = FALSE, ...)
x | Either a list of networks (or square integer matrices), an integer matrix, a network, or an ergmito. |
---|---|
force | Logical scalar. If |
... | Further arguments passed to the method. |
simplify | Logical scalar. When |
#> [[1]] #> [,1] [,2] [,3] [,4] #> [1,] 0 NA NA NA #> [2,] 1 0 NA 1 #> [3,] NA NA 0 NA #> [4,] NA NA NA 0 #> #> [[2]] #> [,1] [,2] [,3] [,4] #> [1,] 0 2 1 1 #> [2,] 1 0 2 2 #> [3,] 1 1 0 1 #> [4,] 2 2 1 0 #> #> [[3]] #> [,1] [,2] [,3] [,4] #> [1,] 0 2 1 3 #> [2,] NA 0 NA 1 #> [3,] 1 1 0 2 #> [4,] NA NA NA 0 #> #> [[4]] #> [,1] [,2] [,3] [,4] #> [1,] 0 1 1 1 #> [2,] NA 0 1 1 #> [3,] NA NA 0 NA #> [4,] NA NA NA 0 #> #> [[5]] #> [,1] [,2] [,3] [,4] #> [1,] 0 NA NA NA #> [2,] NA 0 NA NA #> [3,] 1 NA 0 1 #> [4,] NA NA NA 0 #># 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 ) }#>#>#> #>#>#> #>#>#> #> #> #>#> Error in as.edgelist.sna(dat): object 'net' not found