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

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

Add hub nodes to an existing graph.

expand_neighborhood

Expand neighborhood around roots up to given hop radius using adjacency dict access.

generate_barabasi_albert

Generate a Barabási-Albert scale-free network using preferential attachment.

generate_bipartite_random

Generate a random bipartite graph.

generate_configuration_model_graph

Generate a simple graph from a configuration model with power-law, log-normal, or Poisson degree sequence.

generate_core_periphery

Generate a core-periphery network structure.

generate_degree_corrected_sbm

Generate a degree-corrected SBM.

generate_erdos_renyi

Generate an Erdős-Rényi random graph.

generate_graph_with_seeds_and_targets

Generate a random graph with designated seed and target nodes for embedding evaluation.

generate_grid_torus_lattice

Generate a regular grid or torus lattice.

generate_heterophilic_sbm

Generate an SBM where p_out / p_in is controlled.

generate_hierarchical_network

Generate a hierarchical network with tree-like structure plus random edges.

generate_modular_network

Generate a modular network with clear community structure.

generate_powerlaw_cluster

Generate a random graph with powerlaw degree distribution and clustering.

generate_random_geometric

Generate a random geometric graph in the unit cube.

generate_random_regular_expander_like

Generate a random d-regular graph.

generate_stochastic_block_model

Generate a stochastic block model graph with community structure.

generate_watts_strogatz

Generate a Watts-Strogatz small-world network.

get_graph_statistics

Compute comprehensive statistics for a graph.

induce_subgraph_by_nodes

Materialize an induced subgraph without using G.subgraph(…) to avoid view contamination.

keep_largest_connected_component

Return a connected component while preserving required nodes when possible.

load_graph

Loads the largest connected component (giant component) of a network from a CSV file.

load_gwas_data

load_pegasus_results

load_seeds_and_targets

materialize_undirected_simple_graph

Return a fully materialized undirected simple nx.Graph (no views, no DiGraph internals).

prepare_graph

Step-by-step graph preparation:

sample_degree_sequence

Sample a degree sequence and rescale it to target average degree.

sparsify_edges_biological

Edge-only sparsification: degree-capped selection prioritizing biologically coherent edges.

subsample_nodes

subsample_nodes_with_protected

Subsample nodes while preserving a protected set.

sweep_configuration_model_graphs

Generate sweep of configuration model graphs.

sweep_degree_corrected_sbm

Generate sweep of degree-corrected SBM graphs.

sweep_grid_torus_lattice

Generate sweep of grid/torus lattice graphs.

sweep_heterophilic_sbm

Generate sweep of heterophilic SBM graphs.

sweep_random_regular_expander_like

Generate sweep of random regular graphs.