libpysal.weights.
ODW
(Wo, Wd, transform='r', silence_warnings=True)[source]¶Constructs an o*d by o*d origin-destination style spatial weight for o*d flows using standard spatial weights on o origins and d destinations. Input spatial weights must be binary or able to be sutiably transformed to binary.
o x o spatial weight object amongst o origins
d x d spatial weight object amongst d destinations
is ‘r’ for row standardized
o*d x o*d spatial weight object amongst o*d flows between o origins and d destinations
Examples
>>> import libpysal
>>> O = libpysal.weights.lat2W(2,2)
>>> D = libpysal.weights.lat2W(2,2)
>>> OD = libpysal.weights.ODW(O,D)
>>> OD.weights[0]
[0.25, 0.25, 0.25, 0.25]
>>> OD.neighbors[0]
[5, 6, 9, 10]
>>> OD.full()[0][0]
array([0. , 0. , 0. , 0. , 0. , 0.25, 0.25, 0. , 0. , 0.25, 0.25,
0. , 0. , 0. , 0. , 0. ])