Backbone extraction algorithms for complex networks
Project description
networkx_backbone
Backbone extraction algorithms for complex networks, built on NetworkX.
This library provides 47 functions across 8 modules for extracting backbone structures from weighted and unweighted networks.
Full documentation: https://www.brianckeegan.com/networkx_backbone/
Installation
pip install networkx-backbone
For full functionality (required for statistical tests, bipartite methods, and some structural methods):
pip install networkx-backbone[full]
Or install from source:
git clone https://github.com/brianckeegan/networkx_backbone.git
cd networkx_backbone
pip install -e ".[full]"
Modules
| Module | Description | Key Functions |
|---|---|---|
| statistical | Hypothesis-testing methods | disparity_filter, noise_corrected_filter, marginal_likelihood_filter, ecm_filter, lans_filter |
| structural | Topology-based methods | global_threshold_filter, strongest_n_ties, high_salience_skeleton, metric_backbone, ultrametric_backbone, doubly_stochastic_filter, h_backbone, modularity_backbone, planar_maximally_filtered_graph, maximum_spanning_tree_backbone |
| proximity | Neighborhood-similarity scoring | jaccard_backbone, dice_backbone, cosine_backbone, hub_promoted_index, hub_depressed_index, adamic_adar_index, resource_allocation_index, local_path_index, and more |
| hybrid | Combined approaches | glab_filter |
| bipartite | Bipartite projection backbones | sdsm, fdsm |
| unweighted | Sparsification for unweighted graphs | sparsify, lspar, local_degree |
| filters | Post-hoc filtering utilities | threshold_filter, fraction_filter, boolean_filter, consensus_backbone |
| measures | Evaluation and comparison | node_fraction, edge_fraction, weight_fraction, reachability, ks_degree, ks_weight, compare_backbones |
Quick Start
import networkx as nx
import networkx_backbone as nb
# Create a weighted graph
G = nx.karate_club_graph()
for u, v in G.edges():
G[u][v]["weight"] = 1.0
# Extract backbone using the disparity filter
H = nb.disparity_filter(G)
# Filter to keep only significant edges (p < 0.05)
backbone = nb.threshold_filter(H, "disparity_pvalue", 0.05)
# Compare backbone to original
print(f"Edges kept: {nb.edge_fraction(G, backbone):.1%}")
print(f"Nodes kept: {nb.node_fraction(G, backbone):.1%}")
Proximity-based scoring
# Score edges by Jaccard similarity of endpoint neighborhoods
H = nb.jaccard_backbone(G)
# Keep only the top 20% most structurally embedded edges
backbone = nb.fraction_filter(H, "jaccard", 0.2, ascending=False)
Bipartite backbone
B = nx.Graph()
B.add_edges_from([(1, "a"), (1, "b"), (2, "a"), (2, "c"), (3, "b"), (3, "c")])
backbone = nb.sdsm(B, agent_nodes=[1, 2, 3], alpha=0.05)
Comparing multiple methods
backbones = {
"disparity": nb.threshold_filter(nb.disparity_filter(G), "disparity_pvalue", 0.05),
"mst": nb.maximum_spanning_tree_backbone(G),
}
results = nb.compare_backbones(G, backbones)
Dependencies
- Required:
networkx >= 3.0 - Optional:
numpy >= 1.23,scipy >= 1.9(needed for statistical methods, bipartite methods, doubly stochastic filter, local path index, and KS measures)
Testing
pip install -e ".[test]"
pytest
References
Key papers behind the implemented methods:
- Coscia, M. & Neffke, F. M. (2017). Network backboning with noisy data. Proc. IEEE ICDE, 425-436.
- Grady, D., Thiemann, C., & Brockmann, D. (2012). Robust classification of salient links in complex networks. Nature Communications, 3, 864.
- Hamann, M., Lindner, G., Meyerhenke, H., Staudt, C. L., and Wagner, D. (2016). Structure-Preserving Sparsification Methods for Social Networks. Social Network Analysis and Mining, 6, 22.
- Simas, T., Correia, R. B., & Rocha, L. M. (2021). The distance backbone of complex networks. J. Complex Networks, 9(6), cnab021.
- Neal, Z. P. (2014). The backbone of bipartite projections. Social Networks, 39, 84-97.
- Neal, Z. P. (2022). backbone: An R package to extract network backbones. PLoS One, 17(5), e0269137.
- Serrano, M. A., Boguna, M., & Vespignani, A. (2009). Extracting the multiscale backbone of complex weighted networks. PNAS, 106(16), 6483-6488.
- Yassin, A., Haidar, A., Cherifi, H., Seba, H., & Togni, O. (2023). An evaluation tool for backbone extraction techniques in weighted complex networks. Scientific Reports, 13, 17000.
- Yassin A., Cherifi, H., Seba, H., & Togni, O. (2025). Backbone extraction through statistical edge filtering: A comparative study. PLoS One, 20(1): e0316141.
- Yassin A., Cherifi, H., Seba, H., & Togni, O. (2025). Exploring weighted network backbone extraction: A comparative analysis of structural techniques. PLoS One, 20(5): e0322298.
Other libraries and datasets:
- Yassin, A., Haidar, A., Cherifi, H., Seba, H., & Togni, O. (2023). netbone.
- Yassin, A., et al. (2025). structural-backbone-methods-comparison.
- Neal, Z. (2022). backbone.
- Chrol, B. & Bojanowski, M. (2018). Proximity-based Methods for Link Prediction.
License
BSD 3-Clause License. See LICENSE for details.
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 networkx_backbone-0.1.0.tar.gz.
File metadata
- Download URL: networkx_backbone-0.1.0.tar.gz
- Upload date:
- Size: 51.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
450f2728bea42088d3655767fdacfc0ad225d05720659bd1f00261a603fceb43
|
|
| MD5 |
85cccfae9fa6bd43fee9bc873708673b
|
|
| BLAKE2b-256 |
ed5fa10a16490a0663f3479ae26fb4b79ef13736bd1184af5c2dc9806d2c446d
|
Provenance
The following attestation bundles were made for networkx_backbone-0.1.0.tar.gz:
Publisher:
publish-to-PyPI.yml on brianckeegan/networkx_backbone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
networkx_backbone-0.1.0.tar.gz -
Subject digest:
450f2728bea42088d3655767fdacfc0ad225d05720659bd1f00261a603fceb43 - Sigstore transparency entry: 945879602
- Sigstore integration time:
-
Permalink:
brianckeegan/networkx_backbone@da0b96544c6adaffe3a512c6030bd88e73f98c93 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/brianckeegan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-PyPI.yml@da0b96544c6adaffe3a512c6030bd88e73f98c93 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file networkx_backbone-0.1.0-py3-none-any.whl.
File metadata
- Download URL: networkx_backbone-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.1 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 |
dee577b50e25c7be0600216e8b388fd351fcebea087f121114a4dd517e07bad6
|
|
| MD5 |
276aa5bab09f6f4f7498612541cfbe09
|
|
| BLAKE2b-256 |
fd7e26119c65e0f3786d7fc8991e392d2eee32f443fd471f358cc0a5d146914f
|
Provenance
The following attestation bundles were made for networkx_backbone-0.1.0-py3-none-any.whl:
Publisher:
publish-to-PyPI.yml on brianckeegan/networkx_backbone
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
networkx_backbone-0.1.0-py3-none-any.whl -
Subject digest:
dee577b50e25c7be0600216e8b388fd351fcebea087f121114a4dd517e07bad6 - Sigstore transparency entry: 945879641
- Sigstore integration time:
-
Permalink:
brianckeegan/networkx_backbone@da0b96544c6adaffe3a512c6030bd88e73f98c93 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/brianckeegan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-PyPI.yml@da0b96544c6adaffe3a512c6030bd88e73f98c93 -
Trigger Event:
workflow_dispatch
-
Statement type: