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
Metadata
Release files for missing-edge-randomizer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| missing_edge_randomizer-0.1.0.tar.gz | 6.3 kB | With provenance | Details for missing_edge_randomizer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| missing_edge_randomizer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for missing_edge_randomizer-0.1.0-py3-none-any.whl |
Total release size: 12.0 kB
Release files / missing_edge_randomizer-0.1.0.tar.gz
| Download URL | missing_edge_randomizer-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67853827faf317b73c4e6f0411d9b531fd10a363da477ce98551025c98a315fa
|
|
BLAKE2b-256 checksum How to use checksums |
0c3ebc562b606b7d03d1d67fc87dcea6ff88f77d0bf91c41fe995afe9fc0b1cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logRelease files / missing_edge_randomizer-0.1.0-py3-none-any.whl
| Download URL | missing_edge_randomizer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7fd0f588273cdb9805b559e25a3a0123bc1eeb80fb982cccdd39ffe4d071aad
|
|
BLAKE2b-256 checksum How to use checksums |
88d5c64ba359d5f43f65380aa690fe94ca39395eb1c6d54d124fd8048e80da51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logSecurity for missing-edge-randomizer 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for missing_edge_randomizer-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.