Compute Neighborhood Structures of Specified Order
For a given graph, returns the specified neighborhood structure at the selected order(s).
neighborhood(dat, order, neighborhood.type = c("in", "out", "total"), mode = "digraph", diag = FALSE, thresh = 0, return.all = FALSE, partial = TRUE)
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? |
The adjacency matrix associated with the ith order neighborhood is defined as the identity matrix for order 0, and otherwise depends on the type of neighborhood involved. For input graph G=(V,E), let the base relation, R, be given by the underlying graph of G (i.e., G U G^T) if total neighborhoods are sought, the transpose of G if incoming neighborhoods are sought, or G otherwise. The partial neighborhood structure of order i>0 on R is then defined to be the digraph on V whose edge set consists of the ordered pairs (j,k) having geodesic distance i in R. The corresponding cumulative neighborhood is formed by the ordered pairs having geodesic distance less than or equal to i in R.
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.
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.
Carter T. Butts buttsc@uci.edu
#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))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.