Skip to content

Tools to simulate and compare network dismantling strategies, degree, betweenness, PageRank, and entropy-based entanglement, tracking spectral/Laplacian metrics to quantify functional robustness under targeted attacks.

License

Notifications You must be signed in to change notification settings

CoMuNeLab/functional_robustness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functional Robustness

Quantify how a network’s function degrades under targeted attacks.
This library simulates dismantling trajectories driven by classical centralities (degree, betweenness, PageRank, …) and an entropy-based entanglement centrality, while tracking spectral/diffusion observables derived from the graph Laplacian.


Features

  • Spectral entropy of a graph via Laplacian spectrum.
  • Entanglement centrality: node impact measured as entropy loss after removing its incident edges.
  • Functional dismantling: compare multiple strategies step-by-step and record graph/Laplacian trajectories.
  • Tidy outputs for analysis + optional plotting example.

Install

pip install -e .

Requirements: Python ≥ 3.10, packages: networkx, numpy, scipy (examples also use matplotlib, pandas).


Quickstart

import networkx as nx
from functional_robustness import entropy, entanglement, F_Robust

# Build a toy graph
G = nx.erdos_renyi_graph(60, 0.08, seed=7)
beta = 1.0

# Baselines
H = entropy(G, beta)
ent = entanglement(G, beta)
print(f"Spectral entropy: {H:.3f}")
print("Top-3 by entanglement:", sorted(ent.items(), key=lambda x: x[1], reverse=True)[:3])

# Dismantling trajectories
centralities, traj_graphs, traj_laps = F_Robust(G, beta=beta)

Run the end‑to‑end demo (saves a CSV + plot):

python examples/demo_functional_robustness.py

Outputs will be in ./outputs/:

  • trajectory_metrics.csv
  • entropy_trajectories.png

API (core)

entropy(G: nx.Graph, beta: float) -> float

Compute the graph’s spectral (Gibbs–Boltzmann) entropy from Laplacian eigenvalues.

entanglement(G: nx.Graph, beta: float) -> dict

Return {node: Δentropy} after removing all edges incident to node. Higher values ⇒ higher functional importance.

F_Robust(G: nx.Graph, beta: float) -> tuple[list[str], dict, dict]

Simulate dismantling using multiple centralities. Returns:

  • centralities: list of strategy names
  • traj_graphs: {strategy: [G_0, G_1, ...]}
  • traj_laps: {strategy: [L_0, L_1, ...]}

Project Structure

functional_robustness/
  __init__.py
  entropy.py          # entropy & entanglement
  centrality.py       # classical + functional centralities
  dismantling.py      # F_Robust trajectories
examples/
  demo_functional_robustness.py
pyproject.toml
README.md
LICENSE

License

MIT © CoMuNe Lab

About

Tools to simulate and compare network dismantling strategies, degree, betweenness, PageRank, and entropy-based entanglement, tracking spectral/Laplacian metrics to quantify functional robustness under targeted attacks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages