nb2graph {BARD}R Documentation

Neighborhood list helper functions

Description

These functions operate on neighbood lists generated by the spdep package.

Usage

nb2graph(nb)
neighbors(nb,i,...)
neighbors.nb(nb,i,...)
n.comp.include(nb,include)

Arguments

nb a neighborhood list generated by the spdep package
i block id
include exlusion list
... additional arguments to pass onto neighbor methods

Details

These are primarily bard internal functions, exposed for programmers.

Neighbors is a generic method returning a list of indexes of all blocks directly conneccted to those in the supplied blocks id list.

nb2graph converts a spdep neighborhood object into a graph object suitable for use with rbgl

n.comp.exclude is analogous to n.comp.nb in that it returns the number of connected subgraphs inducd by the neighborhood graph. However, it allows an exlcusion list to be supplied, so that only a subset of the list is examined. This is semantically equivalent to n.comp.nb(subset(nb,i)) but is roughly 10-50x faster.

Value

nb2graph returns a graph object, the others return a vector block ids

Author(s)

Micah Altman Micah_Altman@harvard.edu http://www.hmdc.harvard.edu/micah_altman/

See Also

n.comp.nb

Examples

  suffolk.map <- importBardShape(file.path(system.file("shapefiles", package="BARD"),"suffolk_tracts"))
  snb<-suffolk.map$nb
  neighbors(snb,c(1,2,3))
  kplan <- createKmeansPlan(suffolk.map,5)
  rplan <- createRandomPlan(suffolk.map,5)
  n.comp.include(snb,rplan==1)
  n.comp.include(snb,kplan==1)

[Package BARD version 1.03 Index]