libpysal.weights.order¶
-
libpysal.weights.
order
(w, kmax=3)[source]¶ Determine the non-redundant order of contiguity up to a specific order.
- Parameters
- wW
spatial weights object
- kmaxint
maximum order of contiguity
- Returns
- infodictionary
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 [AS96].
Examples
>>> from libpysal.weights import order, Rook >>> import libpysal >>> w = Rook.from_shapefile(libpysal.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]