libpysal.weights.
order
(w, kmax=3)[source]¶Determine the non-redundant order of contiguity up to a specific order.
Parameters: |
|
---|---|
Returns: |
|
Notes
Implements the algorithm in Anselin and Smirnov (1996) [Anselin1996b]
Examples
>>> from libpysal.weights import lat2W
>>> from libpysal.weights.contiguity import 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]