qbiocode.apps.quvine.api.core module#

Public embedding-extraction API for QuVINE.

from qbiocode.apps.quvine import embed result = embed(graph, “quvine_rwr”) # SGNS walk embedding result = embed(graph, “gat_ctqw_heat”, seeds=s) # one registry method Z = result.embedding # (n_nodes, dim) ndarray

embed returns an EmbedResult carrying the matrix, the node order its rows align to, and metadata about what was actually run.

Summary#

Exceptions:

QuvineMethodError

Raised when a requested method cannot be run or fails during execution.

Classes:

EmbedResult

Result of embed().

Functions:

embed

Extract a single QuVINE embedding from graph using method.

__all__: EmbedResult, QuvineMethodError, embed, list_methods, load_config

Reference#

embed(graph, method, config=None, *, seeds=None, base_seed=None, fuse=False, fuse_method=None, overrides=None, n_jobs=1, chunk_size=30, verbose=False)[source]#

Extract a single QuVINE embedding from graph using method.

Parameters:
  • graph (Graph) – NetworkX graph to embed.

  • method (str) – Method name. SGNS walks ("quvine_rwr", "ctqw", …), a registry method ("node2vec", "gat_ctqw_heat", "quvine_graphgps_dtqw_poly", …), or a fused name ("quvine_fused"). See quvine.api.list_methods().

  • config (Union[DictConfig, dict, str, None]) – OmegaConf/dict/path or None for the packaged default schema.

  • seeds (Optional[Sequence]) – Seed nodes used to build quantum targets for quantum-calibrated registry methods (gat_*/graphgps_*/filter_*/quvine_* GCN-MF).

  • base_seed (Optional[int]) – Override cfg.experiment.base_seed.

  • fuse (bool) – If True, run all cfg.walks.kinds SGNS embeddings and fuse them (equivalent to passing a fused method name).

  • fuse_method (Optional[str]) – Fusion strategy; defaults to cfg.fusion.method.

  • overrides (Union[dict, list, DictConfig, None]) – Deep-merged onto config (dict / DictConfig / dotlist).

  • n_jobs (int) – joblib parallelism for the SGNS walk loop.

  • chunk_size (int) – joblib parallelism for the SGNS walk loop.

  • verbose (bool) – Verbose logging for registry execution.

Return type:

EmbedResult

Returns:

An EmbedResult.

Raises:

QuvineMethodError – unknown method, missing quantum targets, or a failed registry executor.

class EmbedResult(embedding, node_order, method, requested_method, kind, dim, execution_time=0.0, used_quantum_targets=False, extra=<factory>)[source]#

Bases: object

Result of embed().

embedding: ndarray#
node_order: list#
method: str#
requested_method: str#
kind: str#
dim: int#
execution_time: float = 0.0#
used_quantum_targets: bool = False#
extra: Dict[str, Any]#
as_dict()[source]#

Return a {node: vector} mapping.

Return type:

Dict[Any, ndarray]

exception QuvineMethodError[source]#

Bases: RuntimeError

Raised when a requested method cannot be run or fails during execution.