Keywords: Lumbermark, clustering, Genie, HDBSCAN*, DBSCAN, outliers, minimum spanning tree, MST, density estimation, mutual reachability distance.
Refer to the package homepage at https://lumbermark.gagolewski.com/ for the reference manual, tutorials, examples, and benchmarks.
Author and Maintainer: Marek Gagolewski
Lumbermark is a fast and resistant divisive clustering algorithm which identifies a specified number of clusters.
It iteratively chops off sizeable limbs that are joined by protruding segments of a dataset's mutual reachability minimum spanning tree.
The use of a mutual reachability distance pulls peripheral points farther away from each other. Lumbermark is a viable alternative to the HDBSCAN* algorithm. The resulting partitions of different granularities are properly nested. Lumbermark can be viewed as a divisive version of genieclust.
When combined with the deadwood package, it can act as an outlier detector.
To install from PyPI, call:
pip3 install lumbermark # python3 -m pip install lumbermark
To learn more about Python, check out my open-access textbook Minimalist Data Wrangling in Python.
For best performance, advanced users will benefit from compiling the package from sources:
CPPFLAGS="-O3 -march=native" pip3 install quitefastmst deadwood lumbermark --force --no-binary="quitefastmst,deadwood,lumbermark"
🚧 TO DO (help needed): How to enable OpenMP support on macOS in quitefastmst?
To install from CRAN, call:
install.packages("lumbermark")
To learn more about R, check out my open-access textbook Deep R Programming.
For best performance, advanced users will benefit from compiling the package from sources:
Sys.setenv(CXX_DEFS="-O3 -march=native") # for gcc and clang
install.packages(c("quitefastmst", "deadwood", "lumbermark"), type="source")
To enable OpenMP on macOS, execute brew install libomp, and then call in R:
Sys.setenv(CXX_DEFS="-O3 -march=native -Xpreprocessor -fopenmp")
install.packages(c("quitefastmst", "deadwood", "lumbermark"), type="source")
The core functionality is implemented in the form of a C++ library. It can thus be easily adapted for use in other projects.
New contributions are welcome, e.g., Julia, Matlab/GNU Octave wrappers.
Copyright (C) 2025–2026 Marek Gagolewski https://www.gagolewski.com/
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3, 19 November 2007, published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License Version 3 for more details. You should have received a copy of the License along with this program. If not, see (https://www.gnu.org/licenses/).
M. Gagolewski, Lumbermark: Resistant clustering by chopping up mutual reachability minimum spanning trees, 2026, DOI:10.48550/arXiv.2604.07143
See lumbermark's homepage for more references.