libpysal.weights.Voronoi¶
- libpysal.weights.Voronoi(points, criterion='rook', clip='alpha_shape', **kwargs)[source]¶
Voronoi weights for a 2-d point set
Points are Voronoi neighbors if their polygons share an edge or vertex.
- Parameters:
- Returns:
- w
W
instance of spatial weights
- w
Examples
>>> import numpy as np >>> from libpysal.weights import Voronoi >>> np.random.seed(12345) >>> points= np.random.random((5,2))*10 + 10 >>> w = Voronoi(points) >>> w.neighbors {0: [2, 3, 4], 1: [2], 2: [0, 1, 4], 3: [0, 4], 4: [0, 2, 3]}