Skip to main content

Robustness of graph metrics under missing edges

Project description

missing-edge-randomizer

Tests DOI

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

  1. Prepare a CSV matrix describing bipartite connections.
  2. Choose a structural measure (built-in or custom).
  3. Run the final() pipeline.
  4. 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


Download files

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

Source Distribution

missing_edge_randomizer-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

missing_edge_randomizer-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

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

Hashes for missing_edge_randomizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 67853827faf317b73c4e6f0411d9b531fd10a363da477ce98551025c98a315fa
MD5 da9846c48e8389bbe663ccc3be1f9b8a
BLAKE2b-256 0c3ebc562b606b7d03d1d67fc87dcea6ff88f77d0bf91c41fe995afe9fc0b1cc

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file missing_edge_randomizer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for missing_edge_randomizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7fd0f588273cdb9805b559e25a3a0123bc1eeb80fb982cccdd39ffe4d071aad
MD5 5b473f969d1a1474116ead6c8e3d4d66
BLAKE2b-256 88d5c64ba359d5f43f65380aa690fe94ca39395eb1c6d54d124fd8048e80da51

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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