Nearest Neighbor Graph Connections

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

This Demonstration expands on a graphical study of nearest neighbors to look at the statistics of the number of connections. (The original Demonstration, "Nearest Neighbor Networks", looked at a process of connecting nearest neighbors and successively more removed neighbors on an assortment of points in 2D.) The parameter settings specify the number of connections to make from each point to its nearest neighbors and possibly to further neighbors. The first control is for the number of points. The second control is for the neighbor connections in the dot and stick visualization, while the third slider specifies the maximum of a range of neighbor connections over which to explore in the bottom plots. Note that while the parameter set specifies connections from each point to a certain number of neighbors, the result is more complex, with some points connected multiply as back-and-forth connections accumulate, so that clusters of connections form.

Contributed by: Jim Gerdy (March 2011)
Open content licensed under CC BY-NC-SA



The two graphs at the top, from the original Demonstration, show an arrangement of points and connections for the number of neighbors specified and one number beyond.

The bottom-left plot shows ranked plots over the range of neighbors chosen (up to the maximum). That is, for each value for nearest or next neighbors, the ranked graph shows how well the points are connected. As the number of specified neighbors increases, the number of realized connections increases as well. And there is a skew to the result, as a few dots have many connections and many dots are in the tail with fewer connections. Connections are concentrated as a purely probabilistic phenomenon.

The contour plot at the lower right shows the statistics for the number of connections, a PDF in terms of counting the occurrences of different values for resulting connections. It uses the same results as in the ranked plot, but counts the occurrence of each value of connection. A ridge appears, representing the maximum count of connections for each nearest neighbor number. This ridge is more diffuse for larger values of connections as there is statistical variation in the clustering, with the larger reaches from successively farther neighbor connections. Finally both plots reach a maximum plateau at connections. When enough neighbors are connected the points become connected to every other point.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.