SCOTT: Synthesizing Curvature Operations and Topology Tools. Use curvature filtrations for graphs and graph distributions!
Project description
SCOTT
Synthesizing Curvature Operations and Topological Tools
SCOTT is a Python package for computing curvature filtrations for graphs and graph distributions. This repository accompanies our NeurIPS 2023 paper: Curvature Filtrations for Graph Generative Model Evaluation.
Our method introduces a novel way to compare graph distributions, avoiding the limitations of Maximal Mean Discrepancy (MMD), which has known drawbacks.
By combining discrete curvature on graphs with persistent homology, SCOTT provides expressive descriptors of graph sets that are:
- Robust
- Stable
- Expressive
- Compatible with Statistical Testing
The package is highly adaptable, offering several options for user customization, including different curvature computation methods and diverse metrics for comparing persistent homology outputs.
Cite Us
If you find this package useful in your research, please consider citing:
@misc{southern2023curvature,
title={Curvature Filtrations for Graph Generative Model Evaluation},
author={Joshua Southern and Jeremy Wayland and Michael Bronstein and Bastian Rieck},
year={2023},
eprint={2301.12906},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Installation
Using pip
Install curvature-filtrations via pip:
$ pip install curvature-filtrations
Building from Source
Our dependencies are managed with poetry, which can be installed with pip install poetry. To install from source:
- Clone the repository
$ git clone https://github.com/aidos-lab/curvature-filtrations.git
- Navigate to the directory
$ cd curvature-filtrations
- Install dependencies
$ poetry install
Quick Start
The example.py script demonstrates how to compute the distance between two graph distributions.
To use SCOTT with your own data, replace the example graph distributions with your own. Distributions should be lists of networkx graphs or single networkx graphs.
Run our Example Script
python scripts/example.py
Tutorials
For a walkthrough of customization options and the intermediary functionalities supported by SCOTT objects, please see /notebooks. We offer the following two tutorials:
1. Customizing how your comparison is executed: custom_compare.ipynb
Read this section if: Your primary goal is to find the distance between your graph distributions, but you are looking for additional ways to customize the curvature and distance measures used.
Functionalities demonstrated in this tutorial include:
- Changing the method used for curvature calculations and associated hyperparameters
- Selecting and customizing the vectorization used to compare persistence diagrams
2. Breakdown of intermediate functionalities: bagpipeline.ipynb
Read this section if: You want to better understand the underlying workflow of this process and/or are interested in the output from intermediate steps in the process.
Functionalities demonstrated in this tutorial include:
- Calculating curvature for one graph or graph distribution
- Executing a curvature filtration to produce a persistence diagram
- Converting persistence diagrams into a topological descriptor (e.g. persistence landscape)
- Computing the distance between topological descriptors
Both tutorials are supported by /notebooks/utils.py.
Core Components
KILT
KILT stands for: Krvature-Informed Links and Topology is an object that can compute curvature filtrations for single graphs.
import networkx as nx
from scott import KILT,Comparator
G = nx.erdos_reyni(14,0.4)
kilt = KILT(measure="forman_curvature")
D = kilt.fit_transform(G)
print(f"Forman Curvature Filtration:")
print(f"Curvature Filtration Values:{kilt.curvature}")
print(D)
Comparator
Comparator handles comparisons between graphs or graph distributions!
import networkx as nx
from scott import KILT,Comparator
graph_dist1 = [nx.erdos_reyni(10,0.4) for _ in range(40)]
graph_dist2 = [nx.erdos_reyni(20,0.6) for _ in range(50)]
compare = Compare(measure="forman_curvature")
dist = compare.fit_transform(graph_dist1,graph_dist2,metric="image")
print(f"Distance between distributions measured by Forman Filtration: {dist}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file curvature_filtrations-0.1.2.tar.gz.
File metadata
- Download URL: curvature_filtrations-0.1.2.tar.gz
- Upload date:
- Size: 989.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37e829182199fd5f88ea52d65c41106b68359a96a5a9f5178bdf098ba33709c5
|
|
| MD5 |
eb6d8fd0b0a05876ebb5de6d5e6639fc
|
|
| BLAKE2b-256 |
92f60459640cb7e1bfe31dc4b8300b5dfa844b1072f12865cc82b2e0d11d9ca1
|
Provenance
The following attestation bundles were made for curvature_filtrations-0.1.2.tar.gz:
Publisher:
publish_to_pypi.yaml on aidos-lab/curvature-filtrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
curvature_filtrations-0.1.2.tar.gz -
Subject digest:
37e829182199fd5f88ea52d65c41106b68359a96a5a9f5178bdf098ba33709c5 - Sigstore transparency entry: 630195575
- Sigstore integration time:
-
Permalink:
aidos-lab/curvature-filtrations@aae2ffb37c8cf7098e01a835d70b4737c1d003fa -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/aidos-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yaml@aae2ffb37c8cf7098e01a835d70b4737c1d003fa -
Trigger Event:
push
-
Statement type:
File details
Details for the file curvature_filtrations-0.1.2-py3-none-any.whl.
File metadata
- Download URL: curvature_filtrations-0.1.2-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a24de5b563d728ad1e66b51db1ad2e4747f2b175df89592db87bca13940b03d8
|
|
| MD5 |
e9267a6e0ac95a5f692ed610485c5cbc
|
|
| BLAKE2b-256 |
7ff72c30121374cc8977d17064c593ec9acecaad3d64c98f4d553883e853bbce
|
Provenance
The following attestation bundles were made for curvature_filtrations-0.1.2-py3-none-any.whl:
Publisher:
publish_to_pypi.yaml on aidos-lab/curvature-filtrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
curvature_filtrations-0.1.2-py3-none-any.whl -
Subject digest:
a24de5b563d728ad1e66b51db1ad2e4747f2b175df89592db87bca13940b03d8 - Sigstore transparency entry: 630195581
- Sigstore integration time:
-
Permalink:
aidos-lab/curvature-filtrations@aae2ffb37c8cf7098e01a835d70b4737c1d003fa -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/aidos-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish_to_pypi.yaml@aae2ffb37c8cf7098e01a835d70b4737c1d003fa -
Trigger Event:
push
-
Statement type: