Skip to main content

Simple scalar robustness score for networks: spectral gap − singular-value variance + Ollivier–Ricci curvature

Project description

PyPI version PyPI downloads

Graph Robustness Score C(G)

Try it live

One clean number that tells you how robust any network is.
Spectral gap − singular-value variance + real Ollivier–Ricci curvature

Live DemoPaper (Feb 19, 2026)Full package + experiments

Graph Robustness Score Demo

I offer paid network robustness audits (supply-chain, transaction graphs, biotech interaction networks, cyber attack surfaces).
First 3 clients this month get 30% off.


Why this score?

Most graph metrics only look at one thing (connectivity, clustering, or degree distribution).
C(G) combines three complementary views in a single interpretable number:

  • Spectral gap → how well the whole network is connected (big gap = harder to disconnect)
  • Singular-value variance → penalises “superstar” hubs (high variance = fragile to targeted attacks)
  • Ollivier–Ricci curvature → rewards strong local clustering and shortcuts (positive curvature = more robust locally)

Result: a simple scalar that highlights structurally robust motifs even inside random graphs.


Quick start

# 1. Download the full package
wget https://github.com/syedrazaaftab/graph-robustness-score/raw/main/computational-testbed.zip

# 2. One-click reproduction
python notebooks/exploratory.py

How to choose the weights (w₁, w₂, w₃)
Default (recommended for most cases): w₁ = w₂ = w₃ = 1
This balances global connectivity, uniformity, and local clustering.
Quick rules of thumb:
•  Supply-chain / infrastructure graphs  increase w₁
•  Social / influencer networks  increase w₂
•  Biological / molecular graphs  increase w₃
The full package includes a weight-sensitivity heatmap.

### Install as Python package

```bash
pip install graph-robustness-score

from graph_robustness_score import compute_cg
import networkx as nx

G = nx.complete_graph(6)        # example
score = compute_cg(G)
print("C(G) =", score)

# Test it!
from graph_robustness_score import compute_cg
import networkx as nx

G = nx.complete_graph(6)  # example graph
score = compute_cg(G)
print("C(G) =", score)

**New in v0.1.0**: Full Ollivier–Ricci curvature is now available:

```python
# Fast version (default, same as before)
score = compute_cg(G)

# Full accurate Ollivier–Ricci (more precise, slightly slower)
score = compute_cg(G, use_full_ricci=True)

Install the full version with:

pip install "graph-robustness-score[full]"

See `examples/stock_example.py` for a real stock-sector demo (Energy sector scores highest right now).

Paper
“Complexity Functionals on Sparse Random Graphs: Spectral Gap, Singular-Value Variance, and Ollivier–Ricci Curvature Contributions”
Syed Raza Aftab, February 19, 2026
Exact analytic decomposition, regular-graph results, finite-size scaling up to N=800.

Commercial use & consulting
I offer paid network robustness audits (5–7 business days turnaround):
•  Supply-chain resilience reports
•  Fraud / transaction graph analysis
•  Molecular / protein interaction robustness
•  Cybersecurity attack-surface scoring
First 3 clients this month get 30% off + free 30-min call.
Email: aftab011190@gmail.com
or book a free 15-min discovery call (Calendly link coming soon).

Made with ❤️ by Syed Raza Aftab
Independent Researcher, Princeton Meadows, New Jersey, USA
MIT License  Feel free to use the score in your own work (commercial or academic).
Just cite the paper or link back to this repo.

Project details


Download files

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

Source Distribution

graph_robustness_score-0.1.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graph_robustness_score-0.1.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file graph_robustness_score-0.1.1.tar.gz.

File metadata

  • Download URL: graph_robustness_score-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for graph_robustness_score-0.1.1.tar.gz
Algorithm Hash digest
SHA256 74a5800a582a55cd464982aecece6567962c1ab30cd32484d6ac89c32daf8c38
MD5 739476bf67433dc9fdd413921b6e934e
BLAKE2b-256 245c806c242d96d8ec457e113a852e24277504a1476b692ad24aed1502b5acd6

See more details on using hashes here.

File details

Details for the file graph_robustness_score-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for graph_robustness_score-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0800a6b0d405e9fa3225b25e744a49985d01e4f4ce53958f21978befbf031fe5
MD5 ee8c239924ab544dee0198d82c5b1d8f
BLAKE2b-256 6dc4527a91bcfc8318deadcae2a1c471491643f5fd4747d74b7086a21912ef8a

See more details on using hashes here.

Supported by

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