fastforman
An efficient algorithm for computing Forman-Ricci curvature on simplicial complexes
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.5%) to scientific vocabulary
Repository
An efficient algorithm for computing Forman-Ricci curvature on simplicial complexes
Basic Info
- Host: GitHub
- Owner: danillodbs16
- License: other
- Language: Jupyter Notebook
- Default Branch: main
- Size: 23.4 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 6
Metadata Files
README.MD
FastForman - An efficient Forman-Ricci Curvature computation for higher-order faces in Simplicial Complexes
Author: Danillo Barros de Souza
ORCID: 0000-0002-7762-8862
This work is based on our set-theoretical approach for computing Forman-Ricci curvature [1]. We implemented our code in Python and coined fastforman. We profiled time and memory usage and benchmarked against other algorithms in the literature, namely, GeneralisedFormanRicci and HodgeLaplacians. The benchmark codes and reports can be found at [2].
Here, we provide a set-theoretical Python implementation for efficiently computing Forman-Ricci Curvature (FRC) for simplicial complexes. We use our own methods for computing the cliques in the simplicial complexes. For more details, see [3]. For alternative topological computations, see [4].
Current version:
0.6.0
New Features:
- Added FRC computations of filtrations on Vietoris-Rips Complexes;
- No need for importing external packages for computing cliques (e.g.,
networkxandgudhi); - Faster computations and reduced memory usage;
- Input parameters
n_neighborsandmapped_nodesadded;
Caution: The root package structure has changed. See previous versions for comparison.
Content:
setup.pyfastforman/GeometricSimplicialComplex.pyxVietorisRipsComplex.pyx
Example.ipynb
Python version:
3.8.5
Package requirements:
numpynetworkxcythonscikit-learn
Installation:
The folder fastforman and the file setup.py must be placed in the same directory.
Local installation:
To compile setup.py with Cython, run:
python3 setup.py build_ext --inplace
Global installation:
Run:
pip install .
After successful compilation, the package can be imported as:
python
import fastforman as ff
Functions:
1. Computations on Geometric Simplicial Complexes
Use case: Study of geometric information from weighted and unweighted abstract simplicial complexes (in a static perspective).
ff.GeometricSimplicialComplex.compute_FRCComputes the Forman-Ricci Curvature (FRC) up to dimensiondim.
Input:
D: One of the following:- A
dictmapping integers0tolen(D)-1to N-dimensional points; - A symmetric
numpy.matrixof floats; - An undirected
nx.Graph(optionally weighted); - A file path to a
graphmlfile.
- A
cutoff: Float threshold distance.n_neighbors: Integer for nearest neighbors (optional).dim: Maximum simplex dimension.mapped_nodes: Boolean, preserve original node labels.
Output:
A dict where keys are dimensions and values are dicts mapping simplices to FRC values.
ff.GeometricSimplicialComplex.compute_FRC_nodeComputes the FRC for nodes up to dimensiondim.
Input: Same as above.
Output:
A dict with dimensions as keys, and values being dicts mapping nodes to FRC values. Unavailable values are np.nan.
ff.GeometricSimplicialComplex.compute_average_FRCComputes the average FRC up to a given dimension.
Input: Same as above.
Output:
A dict mapping dimensions to average FRC values.
ff.GeometricSimplicialComplex.compute_FRC_frequencyComputes frequency distribution of FRC values up to a given dimension.
Input: Same as above.
Output:
A dict where keys are dimensions and values are dictionaries of frequency distributions.
compute_FRC_node_frequencyComputes frequency of FRC values for nodes.
Input:
D: As described previously.cutoff,n_neighbors,mapped_nodes,dim: Same definitions.
Output:
A dict mapping dimensions to frequency dictionaries for node-level FRC.
2. Computations on Vietoris-Rips Complexes
Use case: Study of geometric information across filtrations.
ff.VietorisRipsComplex.compute_local_FRC
Input:
M:np.ndarray, point cloud;max_dim: Max simplex dimension;max_dist: Cutoff distance;k_nearest: Max number of neighbors;precision: Decimal rounding for distances;metric: Distance metric (e.g., "euclidean");verbose: Enable debugging output.
Output:
Output1:dict, total d-FRC per node;Output2:dict, average d-FRC per node.
Contact and Support:
danillo.dbs16@gmail.com, dbarros@bcamath.org
References:
[1] Barros de Souza, Danillo; da Cunha, Jontatas; Santos, Fernando A.N.; Jost, Juergen; Rodrigues, Serafim (2024). Efficient set-theoretic algorithms for computing high-order Forman-Ricci curvature on abstract simplicial complexes. Proc. R. Soc. A. https://doi.org/10.1098/rspa.2024.0364
[2] Barros de Souza, Danillo (2024). Forman-Ricci curvature benchmark report. Kaggle Repository. https://www.kaggle.com/datasets/danillosouza2020/forman-ricci-curvature-benchmark-report
[3] Barros de Souza, Danillo (2024). Alternative set-theoretical algorithms for efficient computations of cliques in Vietoris-Rips complexes. https://arxiv.org/abs/2502.14593
[4] Barros de Souza, Danillo. FastKnill - Fast computation of Euler characteristics and Knill curvature. https://github.com/danillodbs16/fastknill
Owner
- Name: Danillo Souza
- Login: danillodbs16
- Kind: user
- Location: Bilbao, Spain
- Company: Basque Center for Applied Mathematics
- Website: https://www.bcamath.org/en/people/bcam-members/dbarros-souza
- Repositories: 1
- Profile: https://github.com/danillodbs16
GitHub Events
Total
- Release event: 2
- Push event: 6
- Create event: 2
Last Year
- Release event: 2
- Push event: 6
- Create event: 2
Dependencies
- cython *
- gudhi *
- numpy *
- cython *
- gudhi *
- numpy *
- cython *
- gudhi *
- numpy *
- cython *
- gudhi *
- numpy *
- cython *
- gudhi *
- numpy *