Function Repository Resource:

# DiscreteHausdorffDistance

Find the Hausdorff distance between two sets of elements

Contributed by: Sjoerd Smit
 ResourceFunction["DiscreteHausdorffDistance"][set1, set2] returns the Hausdorff distance between two sets, which is the maximum distance you need to travel from a point in one set to reach a point in the other.

## Details and Options

Given a distance function d that measures the minimum distance from an element to a set, the Hausdorff distance is given by:
ResourceFunction["DiscreteHausdorffDistance"] takes the same options as Nearest.

## Examples

### Basic Examples (2)

Measure the distance between two sets of numbers:

 In[1]:=
 Out[1]=

This is the maximum of the following distances:

 In[2]:=
 Out[2]=
 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

### Scope (1)

Use a custom DistanceFunction for sets of strings:

 In[5]:=
 Out[5]=

### Applications (2)

Compute the distance between sets of points in 2D space:

 In[6]:=
 Out[9]=

Show the maximum distances from one set to the other as arrows. DiscreteHausdorffDistance is equal to the longest of these two arrows:

 In[10]:=
 Out[11]=

Sjoerd Smit

## Version History

• 1.0.0 – 26 April 2023