Mapper-like algorithms from Topological Data Analysis, implemented in Julia.
- Classical Mapper: Filter function + interval covering + DBSCAN clustering + nerve graph
- Ball Mapper: Landmark-based covering with epsilon balls
- Generic Mapper Pipeline: Pluggable cover, refiner, and nerve strategies via abstract interfaces
- Built on MetricSpaces.jl: Re-exports all metric space operations (point clouds, distances, sampling)
using Pkg
Pkg.add("TDAmapper")using TDAmapper
using TDAmapper.ImageCovers, TDAmapper.IntervalCovers, TDAmapper.Refiners
# Generate a point cloud on a circle
X = sphere(1000, dim=2)
# Use x-coordinate as filter function
fv = first.(X)
# Create image covering: 10 overlapping intervals
ic = R1Cover(fv, Uniform(length=10, expansion=0.3))
# Run mapper with DBSCAN clustering
M = classical_mapper(X, ic, DBscan(radius=0.1))
# M.g is the mapper graph, M.C is the covering (index vectors)
println(M) # "Mapper graph with N vertices and M edges"using TDAmapper
# Generate data on a torus
X = torus(2000)
# Select 100 landmarks via farthest point sampling
L = farthest_points_sample_ids(X, 100)
# Build ball mapper with radius 0.8
M = ball_mapper(X, L, 0.8)The mapper pipeline has three pluggable stages:
-
Cover (
AbstractCover): How to partition/cover the dataR1Cover: Pullback of intervals via a filter functionEpsilonBall: Balls of fixed radius around landmarks
-
Refiner (
AbstractRefiner): How to cluster within each cover elementDBscan: DBSCAN clusteringTrivial: No clustering (all points in one cluster)
-
Nerve (
AbstractNerve): How to build the graphSimpleNerve: Edge between overlapping cover elements
All mapper functions return a Mapper struct:
M.X: The original metric spaceM.C: The covering asVector{Vector{Int}}(indices intoM.X)M.g: The nerve graph (from Graphs.jl)
- Singh, G., Memoli, F., & Carlsson, G. (2007). Topological Methods for the Analysis of High Dimensional Data Sets and 3D Object Recognition. Eurographics Symposium on Point-Based Graphics.
- Dlotko, P. (2019). Ball Mapper: A Shape Summary for Topological Data Analysis. arXiv:1901.07410.
- MetricSpaces.jl: Foundation layer for metric spaces and distances
- TDAplots.jl: Visualization of mapper graphs
MIT License