libpysal.weights.Voronoi

libpysal.weights.Voronoi(points, criterion='rook', clip='ahull', **kwargs)[source]

Voronoi weights for a 2-d point set

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

Parameters
pointsarray

(n,2) coordinates for point locations

kwargsarguments to pass to Rook, the underlying contiguity class.
Returns
wW

instance of spatial weights

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]}