Fast Low-Dimensional Embeddings and Clustering via 'Rust'

R interface to the Rust crates 'manifolds-rs', 'ann-search-rs' and 'evoc-rs'. Builds 2D (or higher) embeddings with UMAP (McInnes et al., 2018) , t-SNE (van der Maaten and Hinton, 2008) < https://jmlr.org/papers/v9/vandermaaten08a.html>, densMAP and den-SNE (Narayan et al., 2021) , PHATE (Moon et al., 2019) , PaCMAP (Wang et al., 2021) < https://jmlr.org/papers/v22/20-1061.html>, ForceAtlas2 (Jacomy et al., 2014) , DREAMS and diffusion maps. Also generates approximate nearest neighbour graphs that every method can reuse, plus EVoC and k-means clustering. Multi-threaded via 'Rayon', with f32 or f64 precision.


manifoldsR manifoldsR logo

r_package manifoldsR status badge CI License: MIT pkgdown extendr

Rust-accelerated manifold learning methods with R bindings. For the modern-day single-cell Pollock. Additionally, provides some clustering methods with focus on EVoC (and k-means clustering for comparison purposes).

Overview

2D embedding methods

manifoldsR provides high-performance implementations of popular dimensionality reduction techniques:

  • UMAP (Uniform Manifold Approximation and Projection with various optimisers which makes this fast.)
  • t-SNE (t-Distributed Stochastic Neighbor Embedding - Barnes-Hut, quick-and-dirty Barnes-Hut and FFT-accelerated Interpolation-based versions)
  • PHATE (Potential of Heat-diffusion for Affinity-based Trajectory Embedding)
  • PaCMAP (Pairwise Controlled Manifold Approximation)
  • Diffusion map (A classical method of Manifold learning)
  • Density-preserving versions of UMAP and tSNE
  • DREAMS (t-SNE regularised towards a global reference embedding, PCA by default, so cluster positions keep their meaning)
  • ForceAtlas2 (2FA) (Gephi's force-directed graph layout on the kNN graph)

The core algorithms are implemented purely in Rust without any kernel switching for speed while providing user-friendly R interfaces. The optimisations here make them in parts substantially faster than other libraries typically used in the R ecosystem to run these methods. The backbone here are the Rust crates that enable approximate nearest neighbour searches and the underlying manifold learning methods.
The underlying philosophy is to strip out most additional features and focus on the core mechanics and make them as fast as possible, avoid abstraction layers and indirection wherever possible and let llvm do its magic to generate fast code.

Clustering methods

Additionally, you might want to cluster your data and then visualise it. For this use case, the package also provides the following clustering methods (and of course various metrics around clusters)

  • k-means clustering (mini Batch version and full version with Hamerley's algorithm)
  • EVõC (Embedding Vector Oriented Clustering ported from Python into Rust and exposed here - from Leland McInnes at the Tutte institute).

Installation

Prerequisites

This package requires Rust to be installed on your system. If you don't have Rust installed:

macOS and Linux:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Windows:

Download and run the installer from rustup.rs

After installation, restart your terminal and verify Rust is installed:

rustc --version

Install manifoldsR

You can install the package from r-universe.dev as a pre-compiled binary.

# Install from r-universe (pre-compiled)
install.packages(
  'manifoldsR', 
  repos = c('https://gregorlueg.r-universe.dev', 'https://cloud.r-project.org')
)

Or install from source. That will compile all of the Rust crates from scratch.

# Install from source
remotes::install_github("GregorLueg/manifoldsR")

How to use the package ... ?

Please check out the website and associated vignettes. Changelog can be found here.

Roadmap

For now the package covers the most common embedding versions. Future features are likely to include:

  • [x] PacMap from Wang et. al., that should preserve global structure better. (Done with version 0.1.1)
  • [x] GPU-accelerated versions bixverse.gpu contains now GPU-accelerated kNN searches for the embedding methods and a GPU-accelerated Adam optimiser for UMAP.
  • [x] Density-preserving versions of UMAP and tSNE, see Narayan, et al.. Included now.
  • [x] DREAMS from Kury, Kobak & Damrich, t-SNE with a pull towards a global reference. Included now.

License

Copyright (c) 2026 manifoldsR authors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("manifoldsR")

0.5.0 by Gregor Lueg, 7 hours ago


https://gregorlueg.github.io/manifoldsR/, https://github.com/GregorLueg/manifoldsR


Report a bug at https://github.com/GregorLueg/manifoldsR/issues


Browse source code at https://github.com/cran/manifoldsR


Authors: Gregor Lueg [aut, cre] , Grant Neilson [aut] , Authors of the dependency Rust crates [ctb, cph] (see inst/AUTHORS file)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports checkmate, lifecycle, purrr, stats

Suggests igraph, tinytest, zeallot

System requirements: Cargo (Rust's package manager), rustc >= 1.90, xz


See at CRAN