Metadata-Version: 2.5
Name: damicore-clusterizer
Version: 0.7.1
Summary: FastGreedy clustering stage for the DAMICORE pipeline.
Project-URL: Homepage, https://github.com/delbem-research/damicore
Project-URL: Repository, https://github.com/delbem-research/damicore
Project-URL: Issues, https://github.com/delbem-research/damicore/issues
Project-URL: Documentation, https://delbem-research.github.io/damicore/
Project-URL: Changelog, https://github.com/delbem-research/damicore/blob/main/CHANGELOG.md
Author-email: Ennio Politi Lopes <enniolopes@users.noreply.github.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: clustering,community-detection,damicore,fastgreedy,modularity
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Typing :: Typed
Requires-Python: <3.15,>=3.11
Requires-Dist: igraph<1.1,>=1.0
Requires-Dist: pydantic<3,>=2.10
Description-Content-Type: text/markdown

# damicore-clusterizer

damicore-clusterizer clusters the unrooted form of a validated DAMICORE tree
with igraph FastGreedy and projects the resulting communities onto leaves. The
root is left out and its two edges become one joining its children, their
lengths summed, so every other node is a vertex. It is the
fourth and final stage of the DAMICORE pipeline; most users install the
aggregate `damicore` distribution, which runs all four stages end to end.
Install this package alone to cluster trees without the rest of the pipeline.

```bash
pip install damicore-clusterizer
```

## Python

```python
from damicore_clusterizer import ClusterConfig, cluster_tree

result = cluster_tree("run/tree.json", "run", config=ClusterConfig(num_clusters=None))
```

`tree.json` is produced by the sibling `damicore-tree-builder` distribution; the
call writes cluster membership as `membership.csv` and `clusters.json`. Edge
weights are branch-length reciprocals, shifted and scaled so the smallest is
one, which makes a negative branch the weakest edge rather than the strongest;
output cluster IDs and leaf ordering are deterministic.

## Links

- Repository: <https://github.com/delbem-research/damicore>
- Issues: <https://github.com/delbem-research/damicore/issues>
- Documentation:
  <https://github.com/delbem-research/damicore/blob/main/docs/quickstart.md>

Licensed under Apache-2.0.
