pysal.lib.weights.order

pysal.lib.weights.order(w, kmax=3)[source]

Determine the non-redundant order of contiguity up to a specific order.

Parameters:
w : W

spatial weights object

kmax : int

maximum order of contiguity

Returns:
info : dictionary

observation id is the key, value is a list of contiguity orders with a negative 1 in the ith position

Notes

Implements the algorithm in Anselin and Smirnov (1996) [Anselin1996b]

Examples

>>> from pysal.lib.weights import lat2W
>>> from pysal.lib.weights.contiguity import Rook
>>> import pysal.lib
>>> w = Rook.from_shapefile(pysal.lib.examples.get_path('10740.shp'))

WARNING: there is one disconnected observation (no neighbors) Island id: [163] >>> w3 = order(w, kmax = 3) >>> w3[1][0:5] [1, -1, 1, 2, 1]