Skip to main content

High performance tool for Persistent Homology computations.

Project description

wheels ci docs

giotto-ph

giotto-ph is a high-performance implementation of Vietoris–Rips (VR) persistence on the CPU, and is distributed under the GNU AGPLv3 license. It consists of an improved reimplementation of Morozov and Nigmetov’s “lock-free Ripser” and in addition makes use of a parallel implementation of the apparent pairs optimization used in Ripser v1.2. It also contains an improved reimplementation of GUDHI’s Edge Collapse (EC) algorithm and offers support for weighted VR filtrations. See also Morozov’s Ripser fork, Nigmetov’s Oineus library, and GUDHI’s EC implementation.

giotto-ph is part of the Giotto family of open-source projects and designed for tight integration with the giotto-tda and pyflagser libraries.

Project genesis

giotto-ph is the result of a collaborative effort between L2F SA, the Laboratory for Topology and Neuroscience at EPFL, and the Institute of Reconfigurable & Embedded Digital Systems (REDS) of HEIG-VD.

License

giotto-ph is distributed under the AGPLv3 license. If you need a different distribution license, please contact the L2F team.

Parallel persistent homology backend

Computing persistence barcodes of large datasets and in high homology degrees is challenging even on modern hardware. giotto-ph’s persistent homology backend is able to distribute the key stages of the computation (namely, search for apparent pairs and coboundary matrix reduction) across an arbitrary number of available CPU threads.

On challenging datasets, the scaling is quite favourable as shown in the following figure (for more details, see our paper linked below):

https://raw.githubusercontent.com/giotto-ai/giotto-ph/main/docs/images/multithreading_speedup.svg

Basic usage in Python

Basic imports:

import numpy as np
from gph import ripser_parallel

Point clouds

Persistence diagram of a random point cloud of 100 points in 3D Euclidean space, up to homology dimension 2, using all available threads:

pc = np.random.random((100, 3))
dgm = ripser_parallel(pc, maxdim=2, n_threads=-1)

Distance matrices and graphs

You can also work with distance matrices by passing metric="precomputed":

from scipy.spatial.distance import pdist, squareform

# A distance matrix
dm = squareform(pdist(pc))
dgm = ripser_parallel(pc, metric="precomputed", maxdim=2, n_threads=-1)

More generally, you can work with dense or sparse adjacency matrices of weighted graphs. Here is a dense square matrix interpreted as the adjacency matrix of a fully connected weighted graph with 100 vertices:

# Entries can be negative. The only constraint is that, for every i and j, dm[i, j] ≥ max(dm[i, i], dm[j, j])
# With dense input, the lower diagonal is ignored
adj_dense = np.random.random((100, 100))
np.fill_diagonal(adj_dense, 0)
dgm = ripser_parallel(adj_dense, metric="precomputed", maxdim=2, n_threads=-1)

And here is a sparse adjacency matrix:

# See API reference for treatment of entries below the diagonal
from scipy.sparse import random
adj_sparse = random(100, 100, density=0.1)
dgm = ripser_parallel(adj_sparse, metric="precomputed", maxdim=2, n_threads=-1)

Edge Collapser

Push the computation to higher homology dimensions and larger point clouds/distance matrices/adjacency matrices using edge collapses:

dgm_higher = ripser_parallel(pc, maxdim=5, collapse_edges=True, n_threads=-1)

(Note: not all datasets and configurations will benefit from edge collapses. For more details, see our paper below.)

Weighted Rips Filtrations

Use the weights and weight_params parameters to constructed a weighted Rips filtration as defined in this paper. weights can either be a custom 1D array of vertex weights, or the string "DTM" for distance-to-measure reweighting:

dgm_dtm = ripser_parallel(pc, weights="DTM", n_threads=-1)

Documentation and Tutorials

Jupyter notebook tutorials can be found in the examples folder. The API reference can be found at https://giotto-ai.github.io/giotto-ph.

Installation

Dependencies

The latest stable version of giotto-ph requires:

  • Python (>= 3.7)

  • NumPy (>= 1.19.1)

  • SciPy (>= 1.5.0)

  • scikit-learn (>= 0.23.1)

User installation

The simplest way to install giotto-ph is using pip

python -m pip install -U giotto-ph

If necessary, this will also automatically install all the above dependencies. Note: we recommend upgrading pip to a recent version as the above may fail on very old versions.

Developer installation

Please consult the dedicated page for detailed instructions on how to build giotto-ph from sources across different platforms.

Contributing

We welcome new contributors of all experience levels. The Giotto community goals are to be helpful, welcoming, and effective. To learn more about making a contribution to giotto-ph, please consult the relevant page.

Testing

After installation, you can launch the test suite from inside the source directory

pytest gph

Citing giotto-ph

If you use giotto-ph in a scientific publication, we would appreciate citations to the following paper:

giotto-ph: A Python Library for High-Performance Computation of Persistent Homology of Vietoris–Rips Filtrations, Burella Pérez et al, arXiv:2107.05412, 2021.

You can use the following BibTeX entry:

@misc{burella2021giottoph,
      title={giotto-ph: A Python Library for High-Performance Computation of Persistent Homology of Vietoris--Rips Filtrations},
      author={Julián Burella Pérez and Sydney Hauke and Umberto Lupo and Matteo Caorsi and Alberto Dassatti},
      year={2021},
      eprint={2107.05412},
      archivePrefix={arXiv},
      primaryClass={cs.CG}
}

Community

giotto-ai Slack workspace: https://slack.giotto.ai/

Contacts

maintainers@giotto.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

giotto_ph-0.2.4-cp312-cp312-win_amd64.whl (408.0 kB view details)

Uploaded CPython 3.12 Windows x86-64

giotto_ph-0.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (557.0 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

giotto_ph-0.2.4-cp312-cp312-macosx_10_9_universal2.whl (806.0 kB view details)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

giotto_ph-0.2.4-cp311-cp311-win_amd64.whl (410.0 kB view details)

Uploaded CPython 3.11 Windows x86-64

giotto_ph-0.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (558.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

giotto_ph-0.2.4-cp311-cp311-macosx_10_9_universal2.whl (807.4 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

giotto_ph-0.2.4-cp310-cp310-win_amd64.whl (407.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

giotto_ph-0.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (554.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

giotto_ph-0.2.4-cp310-cp310-macosx_10_9_universal2.whl (800.3 kB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

giotto_ph-0.2.4-cp39-cp39-win_amd64.whl (406.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

giotto_ph-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (555.1 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

giotto_ph-0.2.4-cp39-cp39-macosx_10_9_universal2.whl (800.8 kB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

giotto_ph-0.2.4-cp38-cp38-win_amd64.whl (406.3 kB view details)

Uploaded CPython 3.8 Windows x86-64

giotto_ph-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (554.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

giotto_ph-0.2.4-cp38-cp38-macosx_10_9_universal2.whl (799.7 kB view details)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file giotto_ph-0.2.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dc8a35c3df35b00c68a5639aac647f2a2747bb7bf342e194bc0d8ab1a548d413
MD5 f86614504c33802e0e3e4017bc7be3a5
BLAKE2b-256 b348cebadab04348f80a1ddbd703d547e40aa0504f0f1f91a0b5e36c7dd2d902

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69bf73304f7a454f7144b2cee83e188f51896a9bcb9e823fa6c75aa36ca11da9
MD5 1d49f5541aa8c199cb24a06208f50052
BLAKE2b-256 8701d62936007ec193a3b3dc5526158a54224772f2538944747565ddc5a43884

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 605ff12d7e0251223ce0cb2e0f0794518ced5389e50a8fbeba7a924585931716
MD5 d05441dd51974491974b14e4fd53469c
BLAKE2b-256 168b9ba340e91990e8493683147d11e43df4ea5d5d42187e5e1efb6342e247fc

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0efe781aa51eded6645f62f1266e00ed72a5e81fe87b8fe8208a01d65cfeb074
MD5 534560039c4b3707fdf6b0cc45879bc6
BLAKE2b-256 0c1d3de57bb01660df29ca783bf267b8cfb219e4e9257aaaf83d848f916e27bb

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf044e7dd8a893abd92824989556974847ca1a7ad57345efd140870ad8f2bbd9
MD5 d9bbc6275864f7702c702fbb6106bb3a
BLAKE2b-256 5f34735317b5a23a6b47b56c2359083e2b0d3bc1a3db4d5110bbcad299769749

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a583a3715d96f2eba0b706d735c19056e9fd8e8413e25a007d3ecca562812b2b
MD5 25b400ff87ac7f5a732e5cbcfaef2ffd
BLAKE2b-256 233d658e888e7705b79f7c77aaab28f1ac928f76734e61b1b98b2df574d7f54e

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d2921c1279ffbc0cfcd54574e40b37f3b81e9998fb1a3980b0c75562bd4b058e
MD5 bba4d3388a0972559a3676c81449add5
BLAKE2b-256 101dfe54d20a58ee76b7965058a417f340c86c068e6b34eab3a497c68e3d1357

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8533c908b5124b13024e0e8c800a1ef9434bfd11c80b6dc9271e80e69bdfce13
MD5 c9bb2999ca1ac12531db18bb1d1486bd
BLAKE2b-256 9de3c715eafeb6f34f8dd9a64c48643c5812edd41fc5f2dde5ef318bcbb07cb7

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp310-cp310-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp310-cp310-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 85158dcba2c9340508556b42a92c11b0cedffd64ecf01d196bbd9044390aebdf
MD5 1ec9d1ba987a10cf150216560defd502
BLAKE2b-256 0e93236de3e9d4c6ef9d77865c189f1e675ba67623dbeefa69748cfb94b7ccf7

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: giotto_ph-0.2.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 406.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.11

File hashes

Hashes for giotto_ph-0.2.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 69dbc15bf79f211abfef7226bcda5c5220efb06e67679c9a6ee37e27e7ea2daa
MD5 f5cb576b278307bd6259ce73e8ee46c7
BLAKE2b-256 a10977b260511cb4db27ae112cd264ec127c1090c26a72c972dd91d22d94e54b

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5b7d9788ef37b21b7d7499501b0ed8ce39ce8a1de995041b8550249c90f594f8
MD5 7a07284325f31bd95a51d4e78001ef20
BLAKE2b-256 f3dd488af7346685354841a3cfac499575e17f426247fa9f45d4026312f0d874

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp39-cp39-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp39-cp39-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 ff3f266bf13e3dda895f98d4cc4e5780668499638eb1b55e3652e3613999c27b
MD5 fa2d55fa5fcbefd630aa698458cf7650
BLAKE2b-256 1527a2b0b1b1788f551be3980cc07a20e4ca4fd3a825ad12532198ba59855e88

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: giotto_ph-0.2.4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 406.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.11

File hashes

Hashes for giotto_ph-0.2.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4b09c85b83c5744c37abab35086c163e8c6d5b2c2c899514a7b08cbe8daf721e
MD5 f2fa0e94528f10e018a9d1bfd4100053
BLAKE2b-256 449fecd5d77aefa6ec2067fdb8ed02b1551477c2ec1f55c616cf249297caac65

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef990963901c2b207935c1500b1a1d504e657e04b63957f974adea416d9ace08
MD5 32eeb285c0291093038e05632c2d2594
BLAKE2b-256 26bf2c685016a1d91500833b63fa3ff5edd923477bab4d007fe4437e36ce5e22

See more details on using hashes here.

File details

Details for the file giotto_ph-0.2.4-cp38-cp38-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for giotto_ph-0.2.4-cp38-cp38-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 3eb1aa135b1f82b6e2d0b7beb4896c8ceb6d802053029ce1260b121711325ffd
MD5 7579953a84dc645c21e85f1bc219f97b
BLAKE2b-256 ff6330bcd0c9816610b8647050c86eaaa2442bc5e587b898a9d99748d7adb662

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page