ToMATo, Topological Mode Analysis Tool (Chazal, Guibas, Oudot, Skraba, "Persistence-based clustering in Riemannian manifolds", J. ACM 60, 2013): clustering by the peaks of a density, where a peak counts only if it is persistent.
Take a function f (a density estimate: large at the centre of a cluster) on the vertices of a graph (which vertices are neighbours). Walk through the vertices from the highest value down. A vertex with no higher neighbour is a '''peak''' and starts a cluster; any other vertex joins the cluster of its highest neighbour, and if it also touches another cluster, the two merge when the lower of their peaks is less than tau above the vertex, that is, when the valley between them is shallower than tau. So tau is a depth: peaks that rise more than tau above every pass that joins them stay separate clusters.
The depths of all the valleys are the finite bars of the degree-0 persistent homology of f on the graph, which diagram returns; choose tau in a gap of that diagram, between the depths of the peaks you want and the depths of the noise (Plot.barcode(ToMATo.diagram(...)) shows it).
Bars are in the library's sublevel convention for a superlevel filtration: a peak of height h is born at -h, so a bar's persistence is the depth of its valley.
final case class Clustering(labels: IndexedSeq[Int], peaks: IndexedSeq[Int])
The clusters ToMATo found: labels(v) is the cluster of vertex v, numbered from 0 in order of decreasing peak height, and peaks(c) is the vertex that is the peak of cluster c.
The clusters ToMATo found: labels(v) is the cluster of vertex v, numbered from 0 in order of decreasing peak height, and peaks(c) is the vertex that is the peak of cluster c.
Clusters the points by ToMATo on the k-nearest-neighbour graph, with minus the distance to measure as density (neighbourGraph and density; call clusterGraph with your own for anything else). Choose tau from ToMATo.diagram(ToMATo.density(points, k), ToMATo.neighbourGraph(points, k)).
Clusters the points by ToMATo on the k-nearest-neighbour graph, with minus the distance to measure as density (neighbourGraph and density; call clusterGraph with your own for anything else). Choose tau from ToMATo.diagram(ToMATo.density(points, k), ToMATo.neighbourGraph(points, k)).
The ToMATo clusters of density on the graph for the merging depth tau (>= 0; 0 leaves every local maximum of the graph a cluster of its own, infinity gives one cluster per connected component).
The ToMATo clusters of density on the graph for the merging depth tau (>= 0; 0 leaves every local maximum of the graph a cluster of its own, infinity gives one cluster per connected component).
The density ToMATo uses on a point cloud: minus the distance to measure with k nearest neighbours (a point is its own first neighbour, as in GUDHI), so a point in a dense region is high and a bar's persistence is a distance.
The density ToMATo uses on a point cloud: minus the distance to measure with k nearest neighbours (a point is its own first neighbour, as in GUDHI), so a point in a dense region is high and a bar's persistence is a distance.
The persistence diagram of density on the graph: one finite bar for every valley that joins two peaks, with persistence the depth of the valley, and one essential bar for every connected component of the graph (for its highest peak). The graph is given by neighbours(v), the vertices joined to v; an edge named from one end counts at both.
The persistence diagram of density on the graph: one finite bar for every valley that joins two peaks, with persistence the depth of the valley, and one essential bar for every connected component of the graph (for its highest peak). The graph is given by neighbours(v), the vertices joined to v; an edge named from one end counts at both.