qbiocode.apps.quvine.data package#
Graph and dataset preparation utilities for QuVINE.
Loading graphs and GWAS tables from disk, preprocessing them (sparsification,
largest-connected-component extraction, node subsampling), bounded-radius
ego-net expansion, and a library of synthetic graph generators used by
qbiocode.apps.quvine.reproducibility to build reproducible benchmarks.
Everything here needs only the base install – numpy, pandas, networkx – so
this package is imported eagerly and is unaffected by the [quvine] extra.
Note
Graph-complexity metrics are not here. They live in QBioCode’s own
qbiocode.evaluate_graph() (qbiocode.evaluation.graph_evaluation),
which supersedes the graph_complexity module that used to sit alongside
these files in the standalone QuVINE distribution.
Submodules:
Summary#
__all__ Classes:
PrepareGraphConfig(subsample_nodes: ‘bool’ = False, max_nodes: ‘int’ = 3000, radius: ‘int’ = 2, sparsify_edges: ‘bool’ = True, retain_ratio: ‘float’ = 0.7, max_degree: ‘int’ = 40, scoring: “Literal[‘common_neighbors’, ‘prefer_low_degree’]” = ‘common_neighbors’, verbose: ‘bool’ = False) |
__all__ Functions:
Add hub nodes to an existing graph. |
|
Expand neighborhood around roots up to given hop radius using adjacency dict access. |
|
Generate a Barabási-Albert scale-free network using preferential attachment. |
|
Generate a random bipartite graph. |
|
Generate a simple graph from a configuration model with power-law, log-normal, or Poisson degree sequence. |
|
Generate a core-periphery network structure. |
|
Generate a degree-corrected SBM. |
|
Generate an Erdős-Rényi random graph. |
|
Generate a random graph with designated seed and target nodes for embedding evaluation. |
|
Generate a regular grid or torus lattice. |
|
Generate an SBM where p_out / p_in is controlled. |
|
Generate a hierarchical network with tree-like structure plus random edges. |
|
Generate a modular network with clear community structure. |
|
Generate a random graph with powerlaw degree distribution and clustering. |
|
Generate a random geometric graph in the unit cube. |
|
Generate a random d-regular graph. |
|
Generate a stochastic block model graph with community structure. |
|
Generate a Watts-Strogatz small-world network. |
|
Compute comprehensive statistics for a graph. |
|
Materialize an induced subgraph without using G.subgraph(…) to avoid view contamination. |
|
Return a connected component while preserving required nodes when possible. |
|
Loads the largest connected component (giant component) of a network from a CSV file. |
|
Return a fully materialized undirected simple nx.Graph (no views, no DiGraph internals). |
|
Step-by-step graph preparation: |
|
Sample a degree sequence and rescale it to target average degree. |
|
Edge-only sparsification: degree-capped selection prioritizing biologically coherent edges. |
|
Subsample nodes while preserving a protected set. |
|
Generate sweep of configuration model graphs. |
|
Generate sweep of degree-corrected SBM graphs. |
|
Generate sweep of grid/torus lattice graphs. |
|
Generate sweep of heterophilic SBM graphs. |
|
Generate sweep of random regular graphs. |