Metadata-Version: 2.4
Name: ltcpy
Version: 1.0.2
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Intended Audience :: Science/Research
Summary: Efficient and robust topology-based clustering.
Keywords: cluster,clustering,ltc
Author-email: Balthasar Teuscher <balthasar.teuscher@tum.de>, Johann Maximilian Zollner <maximilian.zollner@tum.de>
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/tum-bgd/ltc

# Lifetime Clustering (LTC)

Efficient and robust topology-based clustering.

<p align="center">
<img src="https://raw.githubusercontent.com/tum-bgd/ltc/refs/heads/main/assets/graphical_abstract.jpg"/>
<figcaption>Graphical abstract of the LTC algorithm (JM Zollner, <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>).</figcaption>
</p>

## Example

This is a minimal example. See [installation](#installation) for how to install.

### Python

```python
from ltcpy import LifetimeClustering

data = ... # data
eps = ... # fixed-radius

ltc = LifetimeClustering(eps) # initialize
ltc.fit(data) # cluster

labels = ltc.labels_ # get labels
```
### Rust

To use directly in Rust, add it with `cargo add ltc-rs` as a dependency to your `Cargo.toml`.

```rust
let x: Vec<Vec<f32>> = ...; // data
let eps: f32 = ...; // fixed-radius

let (labels, lifetime) = ltc_rs::fit(&x,eps); // cluster
```

## Installation

Installing with with `pip` from [`PyPI`](https://pypi.org/project/ltcpy/) with

```bash
pip install ltcpy
```

Alternatively, build from source with [Rust](https://rust-lang.org/tools/install) and [Maturin](https://www.maturin.rs/installation.html). To build and install the `ltcpy` package locally, run:

```sh
maturin develop -m ltc-py/Cargo.toml --release
```

## Layout
| Path | Content |
| --- | --- |
| `./assets` | Example data |
| `./ltc-py` | Python bindings |
| `./ltc-rs` | Rust implementation |
| `./scripts` | Notebook with examples,  Python implementation |

## Reference

```bibtex
@article{ltc,
    author    = {Zollner, Johann M. and Teuscher, Balthasar and Mansour, Wejdene and Werner, Martin},
    title     = {Efficient and Robust Topology-Based Clustering},
}
```

## Funding

This work was supported by the German Federal Ministry of Research, Technology and Space under grant number 16DKWN134.

## License

The project is licensed under the [Apache-2.0 license](https://github.com/tum-bgd/ltc/blob/main/LICENSE) or [opensource.org/licenses/Apache-2.0](https://opensource.org/licenses/Apache-2.0).

