This repository contains the code relative to the paper Topological Spatial Graph Coarsening.
To install the required package, run the following commands:
conda create -n tsgc -c conda-forge gudhiconda activate tsgcpip install matplotlib networkx notebook scikit-learn osmnx openpyxl
You are now ready to run the demo notebook example.ipynb.
All functions relative to coarsening are in coarsening.py. The main function that computes our proposed method is calibrated_graph_reduction.
The file spatial_graphs.py contains the function used to constructu some specific spatial graphs and plot them.
PD_on_graphs.py contains the functions used to build the persistent diagrams as described in our paper.
The graph.py file defines a Graph class that is used in this repository to encode spatial graphs. \
The data/ folder contains fungus data from Fricker et al (2025).