libpysal.weights.hexLat2W¶

libpysal.weights.
hexLat2W
(nrows=5, ncols=5, **kwargs)[source]¶ Create a W object for a hexagonal lattice.
 Parameters
 Returns
 w
W
instance of spatial weights class W
 w
Notes
Observations are row ordered: first k observations are in row 0, next k in row 1, and so on.
Construction is based on shifting every other column of a regular lattice down 1/2 of a cell.
Examples
>>> from libpysal.weights import lat2W, hexLat2W >>> w = lat2W() >>> w.neighbors[1] [0, 6, 2] >>> w.neighbors[21] [16, 20, 22] >>> wh = hexLat2W() >>> wh.neighbors[1] [0, 6, 2, 5, 7] >>> wh.neighbors[21] [16, 20, 22]