libpysal.weights.order¶
-
libpysal.weights.order(w, kmax=
3)[source]¶ Determine the non-redundant order of contiguity up to a specific order.
- Parameters:¶
- Returns:¶
info – observation id is the key, value is a list of contiguity orders with a negative 1 in the ith position
- Return type:¶
dictionary
Notes
Implements the algorithm in [Anselin and Smirnov, 1996].
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]