Calculates the distance, or path length, between two actors part of the same network.
Usage
ts_geodist(net, ego1, ego2, degree = "degree")
Arguments
- net
matrix, the adjacency matrix representing the relations between actors. Valid values are 0 and 1.
- ego1
numeric, value indicating ego1 (row number of net)
- ego2
numeric, value indicating ego2 (row number of net)
- degree
string, the type of path to be considered: "outdegree
"; "indegree
"; "degree
".
Value
numeric vector of length one, with the distance between the two egos. If egos are not connected ts_geodist
returns Inf
.
Details
This function is a wrapper around the function sna::geodist
.
Examples
ts_geodist(net=ts_net1, ego1=6, ego2=8, degree="outdegree")
#> [1] 2
ts_geodist(net=ts_net1, ego1=8, ego2=6, degree="outdegree")
#> [1] Inf
ts_geodist(net=ts_net1, ego1=8, ego2=6, degree="degree")
#> [1] 2