pysal.lib.weights.Voronoi

pysal.lib.weights.Voronoi(points)[source]

Voronoi weights for a 2-d point set

Points are Voronoi neighbors if their polygons share an edge or vertex.

Parameters:
points : array

(n,2) coordinates for point locations

Returns:
w : W

instance of spatial weights

Examples

>>> import numpy as np
>>> np.random.seed(12345)
>>> points= np.random.random((5,2))*10 + 10
>>> w = Voronoi(points)
>>> w.neighbors
{0: [1, 2, 3, 4], 1: [0, 2], 2: [0, 1, 4], 3: [0, 4], 4: [0, 2, 3]}