Robustness of graph metrics under missing edges
Project description
missing-edge-randomizer
missing-edge-randomizer is a Python package for studying the robustness of graph measures under missing edges.
The package constructs a bipartite graph from an input matrix, adds sampled missing edges to generate candidate ground-truth graphs; a set of sampled missing edges starts from smallest possible number of missing edges (no missing edge) to largest possible number of missing edges. The main functionality of package is generating these candidate ground-truth graphs and then evaluating the level of changes in the measures in this candidate ground-truth compared to original given graph.
Features
-
Construct bipartite graphs from matrix-form CSV data
-
Randomly sample missing edges
-
Generate perturbed graph ensembles
-
Evaluate structural graph measures, including:
Centrality
- Betweenness centrality variance
- PageRank variance
Community Detection
- Greedy modularity
- Girvan-Newman
- Louvain
- Label propagation
- Infomap
- Bipartite stochastic block model (biSBM)
- Leiden
Spectral Properties
- Largest Laplacian eigenvalue
- Number of nonzero Laplacian eigenvalues
- Number of connected components
-
Supports user-defined custom graph measures
Installation
Basic installation
pip install .
Installation with advanced community-detection features
pip install .[advanced]
The advanced option installs optional dependencies required for Infomap, Leiden, igraph, and graph-tool based methods.
Usage
Using a built-in measure
from missing_edge_randomizer import final
final("data.csv", "results", "num components")
Using a custom user-defined measure
from missing_edge_randomizer import final
def my_measure(G):
return G.number_of_edges()
final("data.csv", "custom_results", my_measure)
Input Format
The package expects a CSV file representing a matrix.
Each entry is interpreted as:
0→ no edge\- nonzero value → edge present
The matrix is treated as the biadjacency matrix of a bipartite graph.
Output
Results are saved as a NumPy .npy file containing the evaluated
measure across sampled graphs.
Example Workflow
- Prepare a CSV matrix describing bipartite connections.
- Choose a structural measure (built-in or custom).
- Run the
final()pipeline. - Analyze the saved NumPy results.
Testing
To run the test suite:
pytest
Citation
If you use this software in academic research, please cite the associated paper: "A Technique for Assessing the Robustness of Network Structural Metrics under Incomplete Data".
Author
Sanaz Hasanzadeh Fard and Emily Dolson
License
MIT License
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 missing_edge_randomizer-0.1.0.tar.gz.
File metadata
- Download URL: missing_edge_randomizer-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67853827faf317b73c4e6f0411d9b531fd10a363da477ce98551025c98a315fa
|
|
| MD5 |
da9846c48e8389bbe663ccc3be1f9b8a
|
|
| BLAKE2b-256 |
0c3ebc562b606b7d03d1d67fc87dcea6ff88f77d0bf91c41fe995afe9fc0b1cc
|
Provenance
The following attestation bundles were made for missing_edge_randomizer-0.1.0.tar.gz:
Publisher:
publish.yml on sanaz-fard/missing-edge-randomizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
missing_edge_randomizer-0.1.0.tar.gz -
Subject digest:
67853827faf317b73c4e6f0411d9b531fd10a363da477ce98551025c98a315fa - Sigstore transparency entry: 1059480591
- Sigstore integration time:
-
Permalink:
sanaz-fard/missing-edge-randomizer@8009fd7f78f4c8729143d7b2887104bba5d90045 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/sanaz-fard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8009fd7f78f4c8729143d7b2887104bba5d90045 -
Trigger Event:
release
-
Statement type:
File details
Details for the file missing_edge_randomizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: missing_edge_randomizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 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 |
d7fd0f588273cdb9805b559e25a3a0123bc1eeb80fb982cccdd39ffe4d071aad
|
|
| MD5 |
5b473f969d1a1474116ead6c8e3d4d66
|
|
| BLAKE2b-256 |
88d5c64ba359d5f43f65380aa690fe94ca39395eb1c6d54d124fd8048e80da51
|
Provenance
The following attestation bundles were made for missing_edge_randomizer-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on sanaz-fard/missing-edge-randomizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
missing_edge_randomizer-0.1.0-py3-none-any.whl -
Subject digest:
d7fd0f588273cdb9805b559e25a3a0123bc1eeb80fb982cccdd39ffe4d071aad - Sigstore transparency entry: 1059480592
- Sigstore integration time:
-
Permalink:
sanaz-fard/missing-edge-randomizer@8009fd7f78f4c8729143d7b2887104bba5d90045 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/sanaz-fard
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8009fd7f78f4c8729143d7b2887104bba5d90045 -
Trigger Event:
release
-
Statement type: