Function Repository Resource:

# VoronoiCellTours

Compute shortest tours visiting all lattice points within each Voronoi cell in a region

Contributed by: Shiv Kampani
 ResourceFunction["VoronoiCellTours"][pts, reg] computes shortest tours starting from each point in pts within each Voronoi cell of the Voronoi diagram from pts within the region reg.

## Details

A Voronoi diagram is generated within reg from pts such that each Voronoi cell contains exactly one point from pts. The shortest tour visiting all lattice points within a given Voronoi cell is computed for all Voronoi cells in the generated Voronoi diagram.
Points in pts are considered starting points for each of the shortest tours computed. Shortest tours start and end at the same point.
Lattice points that lie on the edges of a Voronoi cell are also considered to be within that cell and are included in the shortest tour.
ResourceFunction["VoronoiCellTours"] is similar to the procedure used in this Wolfram Community post. The tours computed by ResourceFunction["VoronoiCellTours"] are shorter and more efficient than the paths computed in that post. This is because ResourceFunction["VoronoiCellTours"] takes the region as a parameter whereas the Community post does not.
The method used in this Wolfram Community post represents the optimum method of exploring an unknown region and ResourceFunction["VoronoiCellTours"] represents the optimum method of exploring a known region.

## Examples

### Basic Examples (1)

Compute shortest tours starting at three random starting points within a rectangle:

 In[1]:=
 Out[5]=

### Scope (2)

Compute the shortest tour from a single point within a rectangle:

 In[6]:=
 Out[9]=

Compute shortest tours within Voronoi cells from five random points within a random convex polygon:

 In[10]:=
 Out[14]=

### Applications (1)

Use the resource function LloydAlgorithm with VoronoiCellTours for shortest tours within Voronoi cells of similar areas:

 In[15]:=
 Out[20]=

### Possible Issues (2)

If a point does not lie within the region, a shortest tour is not computed within the point's Voronoi cell:

 In[21]:=
 Out[24]=

VoronoiCellTours is not able to correctly compute shortest tours for some concave regions:

 In[25]:=
 Out[29]=

### Neat Examples (2)

Compute shortest tours within Voronoi cells from eight random points within a convex polygon:

 In[30]:=
 Out[34]=

Compute shortest tours within Voronoi cells from 10 random points within a large disk region:

 In[35]:=
 Out[39]=

Shiv Kampani

## Version History

• 1.0.0 – 23 August 2021