pysal.lib.weights.
higher_order
(w, k=2)[source]¶Contiguity weights object of order k.
Parameters: 


Returns: 

Notes
Proper higher order neighbors are returned such that i and j are korder neighbors iff the shortest path from ij is of length k.
Examples
>>> from pysal.lib.weights import lat2W
>>> w10 = lat2W(10, 10)
>>> w10_2 = higher_order(w10, 2)
>>> w10_2[0] == {2: 1.0, 11: 1.0, 20: 1.0}
True
>>> w5 = lat2W()
>>> w5[0] == {1: 1.0, 5: 1.0}
True
>>> w5[1] == {0: 1.0, 2: 1.0, 6: 1.0}
True
>>> w5_2 = higher_order(w5,2)
>>> w5_2[0] == {10: 1.0, 2: 1.0, 6: 1.0}
True