neighborhood {sna} | R Documentation |
Compute Neighborhood Structures of Specified Order
Description
For a given graph, returns the specified neighborhood structure at the selected order(s).
Usage
neighborhood(dat, order, neighborhood.type = c("in", "out", "total"),
mode = "digraph", diag = FALSE, thresh = 0, return.all = FALSE,
partial = TRUE)
Arguments
dat |
one or more graphs. |
order |
order of the neighborhood to extract. |
neighborhood.type |
neighborhood type to employ. |
mode |
|
diag |
logical; do the diagonal entries of |
thresh |
dichotomization threshold to use for |
return.all |
logical; return neighborhoods for all orders up to |
partial |
logical; return partial (rather than cumulative) neighborhoods? |
Details
The adjacency matrix associated with the th order neighborhood is defined as the identity matrix for order 0, and otherwise depends on the type of neighborhood involved. For input graph
, let the base relation,
, be given by the underlying graph of
(i.e.,
) if total neighborhoods are sought, the transpose of
if incoming neighborhoods are sought, or
otherwise. The partial neighborhood structure of order
on
is then defined to be the digraph on
whose edge set consists of the ordered pairs
having geodesic distance
in
. The corresponding cumulative neighborhood is formed by the ordered pairs having geodesic distance less than or equal to
in
.
Neighborhood structures are commonly used to parameterize various types of network autocorrelation models. They may also be used in the calculation of certain types of local structural indices; gapply
provides an alternative function which can be used for this purpose.
Value
An array or adjacency matrix containing the neighborhood structures (if dat
is a single graph); if dat
contains multiple graphs, then a list of such structures is returned.
Author(s)
Carter T. Butts buttsc@uci.edu
See Also
Examples
#Draw a random graph
g<-rgraph(10,tp=2/9)
#Show the total partial out-neighborhoods
neigh<-neighborhood(g,9,neighborhood.type="out",return.all=TRUE)
par(mfrow=c(3,3))
for(i in 1:9)
gplot(neigh[i,,],main=paste("Partial Neighborhood of Order",i))
#Show the total cumulative out-neighborhoods
neigh<-neighborhood(g,9,neighborhood.type="out",return.all=TRUE,
partial=FALSE)
par(mfrow=c(3,3))
for(i in 1:9)
gplot(neigh[i,,],main=paste("Cumulative Neighborhood of Order",i))