Abstract 1 Introduction 2 Neighborhood graphs 3 Clustering 4 Conclusion References

Proximity Alert: Ipelets for Neighborhood Graphs and Clustering

Gitan Balogh Department of Computer Science, University of Maryland, College Park, MD, USA    June Cagan Department of Computer Science, University of Maryland, College Park, MD, USA    Bea Fatima Department of Physics, Utrecht University, The Netherlands    Auguste H. Gezalyan ORCID Université de Lorraine, CNRS, Inria, LORIA, F-54000 Nancy, France    Danesh Sivakumar ORCID Department of Computer Science, University of Maryland, College Park, MD, USA    Arushi Srinivasan Department of Computer Science, University of Maryland, College Park, MD, USA    Yixuan Sun Department of Computer Science, University of Maryland, College Park, MD, USA    Vahe Zaprosyan Department of Computer Science, University of Maryland, College Park, MD, USA    David M. Mount ORCID Department of Computer Science, University of Maryland, College Park, MD, USA
Abstract

Neighborhood graphs and clustering algorithms are fundamental structures in both computational geometry and data analysis. Visualizing them can help build insight into their behavior and properties. The Ipe extensible drawing editor, developed by Otfried Cheong, is a widely used software system for generating figures. One particular aspect of Ipe is the ability to add Ipelets, which extend its functionality. Here we showcase a set of Ipelets designed to help visualize neighborhood graphs and clustering algorithms. These include: ε-neighbor graphs, furthest-neighbor graphs, Gabriel graphs, k-nearest neighbor graphs, kth-nearest neighbor graphs, k-mutual neighbor graphs, kth-mutual neighbor graphs, asymmetric k-nearest neighbor graphs, asymmetric kth-nearest neighbor graphs, relative-neighbor graphs, sphere-of-influence graphs, Urquhart graphs, Yao graphs, and clustering algorithms including complete-linkage, DBSCAN, HDBSCAN, k-means, k-means++, k-medoids, mean shift, and single-linkage. Our Ipelets are all programmed in Lua and are freely available.

Keywords and phrases:
neighborhood graphs, clustering, proximity graphs, Ipelets, visualization
Category:
Media Exposition
Copyright and License:
[Uncaptioned image] © Gitan Balogh, June Cagan, Bea Fatima, Auguste H. Gezalyan, Danesh Sivakumar,
Arushi Srinivasan, Yixuan Sun, Vahe Zaprosyan, and David M. Mount; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
Supplementary Material:

Software  (Source Code): https://github.com/Otcavo/Ipelets-Full-Library [1]
Audiovisual  (Video): https://youtu.be/NQr-SY1x2qc [2]
Editors:
Hee-Kap Ahn, Michael Hoffmann, and Amir Nayyeri

1 Introduction

We present a set of Ipelets for visualizing clustering and neighborhood graph algorithms on point sets in 2. These Ipelets include: ε-neighbor graphs, furthest-neighbor graphs, Gabriel graphs, k-nearest neighbor graphs, kth-nearest neighbor graphs, k-mutual neighbor graphs, kth-mutual neighbor graphs, asymmetric k-nearest neighbor graphs, asymmetric kth-nearest neighbor graphs, relative-neighbor graphs, sphere-of-influence graphs, Urquhart graphs, Yao graphs, and clustering algorithms including complete-linkage, DBSCAN, HDBSCAN, k-means, k-means++, k-medoids, mean shift, and single-linkage. Some of these are also implemented in CGAL [9]. All our Ipelets are programmed in Lua and are freely available on GitHub. To install any Ipelet, download the file from the GitHub repository, and place it in the ipelets sub-folder of your Ipe folder. This work builds on previous ipelets to add functionality in various contexts [14, 4, 12, 8]. Our contribution is in line with that of several other researchers who have worked on neighborhoods of point sets, such as Voronoi diagrams and Delaunay triangulations [14, 4], and β-skeletons [11]. Ipelets can be invoked from the “Ipelets” menu, see Figure 1 for usage instructions.

Figure 1: (a) Place a point set in Ipe, (b) select the points, (c) choose a graph from the “Ipelets” menu, (d) enter a parameter value if prompted, (e) the resulting graph is drawn automatically.

2 Neighborhood graphs

In this section, we describe the neighborhood graphs our Ipelets compute on point sets. We loosely separate them by type and briefly describe our contributions.

2.1 Nearest-neighbor variants

Nearest neighborhood graphs are fundamental tools in data analysis on a point set P. A point pP is connected to qP when one is the nearest neighbor of the other. The k-nearest neighbor graph connects p to q when q is among the k nearest neighbors of p; the kth-nearest neighbor graph connects p to q when q is the kth nearest neighbor of p; mutual nearest neighbor graphs connect p to q when each is the other’s nearest neighbor; the k-mutual neighbor graph connects p to q when each is among the other’s k nearest neighbors; the kth-mutual neighbor graph connects p to q when each is exactly the other’s kth nearest neighbor; asymmetric nearest neighbor graphs connect p to q when exactly one is the other’s nearest neighbor; asymmetric k-nearest neighbor graphs connect p to q when exactly one has the other among their k nearest neighbors; asymmetric kth-nearest neighbor graphs connect p to q when exactly one has the other as their kth nearest neighbor; and furthest neighbor graphs connect p to q when q is p’s furthest neighbor. See illustration in Figure 2.

Figure 2: (a) Nearest, (b) kth-nearest, (c) k-nearest, (d) mutual nearest, (e) kth-mutual, (f) k-mutual, (g) asymmetric nearest, (h) asymmetric kth-nearest, (i) asymmetric k-nearest, and (j) furthest neighbor graphs. In each k=3.

2.2 Proximity graphs

A proximity graph is a graph in which points are connected when a region-based condition is satisfied, often in the context of network analysis. The Gabriel graph connects two points p and q when the disk defined by the diameter of p and q contains no other points [10]. A relative neighborhood graph connects two points p and q exactly when no point is closer to both p and q than they are to each other, or equivalently, no point is in the lune of p and q (intersection of the ball at p with q on its boundary and the ball at q with p on its boundary) [15]. A sphere of influence graph assigns to each point a disk with radius given as the distance to its nearest neighbor and connects points when their disks overlap [16]. An ε-graph connects pairs of points if they lie within ε of each other. A Urquhart graph is the Delaunay triangulation with the longest edge of each triangle removed [17]. A Yao graph divides the plane into sectors by angle around points, and points are connected to their closest neighbor per sector [18]. See visuals in Figure 3.

Figure 3: (a) Relative neighbor, (b) Gabriel graph, (c) Urquhart graph, (d) ε-neighbor (ε=28), (e) sphere of influence, and (f) Yao graph (k=5).

3 Clustering

In this section, we describe the clustering algorithms we implemented for point sets. As before, we loosely separate them by type and briefly describe our contributions.

3.1 Centroid-based

Centroid-based clustering partitions a point set in space into clusters using a centroid-based method. The k-Means clustering partitions points into k clusters, assigning points to its nearest centroid and recomputing the centroids iteratively until it is stable. The k-Means++ variant is similar, except it chooses initial centroids that are likely to be far apart to improve convergence. Unlike k-means, k-Medoids clustering uses preexisting points in the data as the centroids of the cluster [13]. Each iteration, a point replaces the medoid if it decreases the total intra-cluster distance. Illustrations of the methods can be seen in Figure 4.

Figure 4: (a) k-Means, (b) k-Means++, and (c) k-Medoids.

3.2 Hierarchical

Hierarchical clustering methods work by treating each point as a cluster and iteratively merging clusters until only a specified number remain. Single-linkage clustering defines the cluster distance between clusters as the minimum pairwise distance between their points, while complete-linkage clustering uses the maximum [7]. See Figure 5.

Figure 5: (a) Single Linkage Clustering, (b) Complete Linkage Clustering.

3.3 Density-based

Density-based clustering partitions a point set into clusters based on how densely points are packed. DBSCAN groups points that are within a specified distance, ε, of each other and have a minimum number of neighboring points (MinPts). Points meeting these criteria form clusters (distinguished by colors), while points that don’t are labeled as noise [6]. HDBSCAN, on the other hand, applies a hierarchical approach to density-based clustering [3]. It builds a mutual reachability graph and a minimum spanning tree to identify clusters at varying densities. Instead of relying on a fixed distance threshold like DBSCAN, HDBSCAN evaluates the stability of clusters across different scales. It then uses the Excess of Mass method to select stable clusters. Mean shift computes where each point would converge if moved towards the mean of its neighbors within the given bandwidth radius. Points whose trajectories converge on the same location form a cluster [5]. See Figure 6.

Figure 6: (a) HDBSCAN, (b) DBSCAN, and (c) Mean shift.

4 Conclusion

In this paper, we presented a collection of Ipelets for visualizing neighborhood graphs and clustering algorithms on point sets in 2. These tools are designed to assist in the understanding of these structures and their properties, and we hope they will be useful to researchers, educators, and artists alike. All Ipelets are freely available on GitHub.

Figure 7: Artwork made using the k nearest neighbors Ipelet.

References

  • [1] Gitan Balogh, June Cagan, Bea Fatima, Auguste H. Gezalyan, Danesh Sivakumar, Arushi Srinivasan, Yixuan Sun, Vahe Zaprosyan, and David M. Mount. Proximity Alert: Ipelets for Neighborhood Graphs and Clustering. Software (visited on 2026-05-12). URL: https://github.com/Otcavo/Ipelets-Full-Library, doi:10.4230/artifacts.25979.
  • [2] Gitan Balogh, June Cagan, Bea Fatima, Auguste H. Gezalyan, Danesh Sivakumar, Arushi Srinivasan, Yixuan Sun, Vahe Zaprosyan, and David M. Mount. Proximity Alert: Ipelets for Neighborhood Graphs and Clustering. Audiovisual (visited on 2026-05-12). URL: https://youtu.be/NQr-SY1x2qc, doi:10.4230/artifacts.25983.
  • [3] Ricardo J. G. B. Campello, Davoud Moulavi, and Jörg Sander. Density-based clustering based on hierarchical density estimates. In Advances in Knowledge Discovery and Data Mining, pages 160–172. Springer, 2013. doi:10.1007/978-3-642-37456-2_14.
  • [4] Otfried Cheong. The IPE extensible drawing editor. Version 7.2.28, 2024-03-12. URL: https://ipe.otfried.org/.
  • [5] Dorin Comaniciu and Peter Meer. Mean shift: A robust approach toward feature space analysis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 24(5):603–619, 2002. doi:10.1109/34.1000236.
  • [6] Martin Ester, Hans-Peter Kriegel, Jörg Sander, and Xiaowei Xu. A density-based algorithm for discovering clusters in large spatial databases with noise. In Proceedings of the 2nd International Conference on Knowledge Discovery and Data Mining (KDD), pages 226–231, 1996. URL: http://www.aaai.org/Library/KDD/1996/kdd96-037.php.
  • [7] Brian S. Everitt, Sabine Landau, Morven Leese, and Daniel Stahl. Cluster Analysis. Wiley, 5th edition, 2011. doi:10.1002/9780470977811.
  • [8] Klint Faber, Auguste H. Gezalyan, Adam Martinson, Aniruddh Mutnuru, Nithin Parepally, Ryan Parker, Mihil Sreenilayam, Aram Zaprosyan, and David M. Mount. French onion soup, ipelets for points and polygons (media exposition). In 41st International Symposium on Computational Geometry (SoCG 2025), pages 83:1–83:6. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2025. doi:10.4230/LIPIcs.SoCG.2025.83.
  • [9] Andreas Fabri and Sylvain Pion. CGAL: The computational geometry algorithms library. In Proceedings of the 17th ACM SIGSPATIAL international conference on advances in geographic information systems, pages 538–539, 2009. doi:10.1145/1653771.1653865.
  • [10] K. Ruben Gabriel and Robert R. Sokal. A new statistical approach to geographic variation analysis. Systematic Zoology, 18(3):259–278, 1969. doi:10.2307/2412323.
  • [11] David G. Kirkpatrick and John D. Radke. A framework for computational morphology. In G. T. Toussaint, editor, Computational Geometry, pages 217–248. North-Holland, 1985. doi:10.1016/B978-0-444-87806-9.50013-X.
  • [12] Nithin Parepally, Ainesh Chatterjee, Auguste H. Gezalyan, Hongyang Du, Sukrit Mangla, Kenny Wu, Sarah Hwang, and David M. Mount. Ipelets for the convex polygonal geometry (media exposition). In 40th International Symposium on Computational Geometry (SoCG 2024), pages 92:1–92:7, 2024. doi:10.4230/LIPIcs.SoCG.2024.92.
  • [13] Hae-Sang Park and Chi-Hyuck Jun. A simple and fast algorithm for K-medoids clustering. Expert Systems with Applications, 36(2):3336–3341, 2009. doi:10.1016/j.eswa.2008.01.039.
  • [14] postechDNN. Ipelet. https://github.com/postechDNN/postechDNN/commits/ipelet/dnn/IPELET, 2022. (Commit hash: de82a8d).
  • [15] Godfried T. Toussaint. The relative neighbourhood graph of a finite planar set. Pattern Recognition, 12(4):261–268, 1980. doi:10.1016/0031-3203(80)90066-7.
  • [16] Godfried T. Toussaint. A graph-theoretical primal sketch. Computational Morphology, pages 229–260, 1988.
  • [17] RB Urquhart. Algorithms for computation of relative neighbourhood graph. Electronics Letters, 16(14):556–557, 1980.
  • [18] Andrew Chi-Chih Yao. On constructing minimum spanning trees in k-dimensional spaces and related problems. SIAM Journal on Computing, 11(4):721–736, 1982. doi:10.1137/0211059.