A function to find the neighbourhood of an actor or group of actors with a customized distance.
neighb(x, rs, type = c("und", "inn", "out"), k = 1, inclx = FALSE, expand)
Depending on expand
, the output is either a vector or a list with the neighbour nodes to the reference actor(s).
the reference actor labeled in rs
or a vector of several actors
the relational system of the network
whether the system is
und
for undirected (default)
inn
for incoming node's ties to the reference actor
out
for outgoing arcs from the reference actor
the “distance” of the neighbour nodes to the reference actor (where k=1
gives the adjacent nodes)
(logical) should the reference actor be included in the output?
(optional and logical) should the output be given by k
(it only makes sense when k>1
)
Antonio Rivero Ostoic
The relational system serves to represent either the entire multiple network made of actors, or else just the relational bundles having a mutual or an asymmetric character in the system.
In this sense, this function detects the adjacent nodes to ‘x
’ according to the specified relational system, but as well the neighbours of the adjacent nodes with a customized length.
Eventually, when the longest path or chain is reached, adding more value to k
obviously will not produce more nodes in the graph system.
Type options inn
and out
are for directed networks.
expos
, rel.sys
, bundles
# create the data: two binary relations among three elements
arr <- round( replace( array( runif(18), c(3 ,3, 2) ), array( runif(18),
c(3, 3, 2) ) > .9, 3 ) )
# establish the system of strong bonds
rs <- rel.sys(arr, bonds = "strong")
# obtain inmediate neighbourhood of the first node
neighb(1, rs)
Run the code above in your browser using DataLab