conninfpy.topologies
Named topology scenarios for benchmarking enhancement methods on
synthetic connectivity. Promoted from examples/ to the public API
on 2026-04-18.
Provides 19 named scenarios covering the topologies most likely to arise in real connectivity data: within-module-dense, between-modules-dense, hub, rich-club, scattered, chain, gradient-core-periphery, partial-bipartite, fragmented-within-module, cross-block-connected-chain, plus secondary variants.
Public surface:
TopologyDatasetGenerator— main generator classTopologyDataset— output container (.group1,.group2,.mask,.net_labels,.scenario)TopologyScenario— scenario specificationlist_scenarios()— return all scenario namesget_scenarios()— return all scenario specsget_scenario()— look up a specific scenario by name
The MICCAI 2026 power benchmark
(examples/miccai_paper_reproducing/) sweeps all enhancement methods
across all 19 topologies; its findings are summarized in the
“no-method-dominates-across-topologies” empirical message of the
ConnInfPy paper.
Topology-based synthetic connectivity scenarios.
Built on top of conninfpy.synth_datasets.ModularDatasetGenerator,
this module adds a library of named topological effect patterns (hub,
chain, rich-club, checkerboard, gradient, etc.) plus a scenario registry
so callers can request a scenario by name.
Public API
TopologyScenario— scenario specificationTopologyDataset— generated output containerTopologyDatasetGenerator— the main entry pointlist_scenarios(),get_scenario(),get_scenarios()— registry
Mask generator functions (_mask_*, _scenario_mask_*) are private;
access them indirectly via the scenario registry.
Example
>>> from conninfpy.topologies import TopologyDatasetGenerator, list_scenarios
>>> list_scenarios()[:3]
['within_module_dense', 'between_modules_dense', 'hub']
>>> gen = TopologyDatasetGenerator(n_nodes=60, n_modules=4, seed=1)
>>> ds = gen.generate("chain", effect_size=0.3, n_samples=20, time_points=30)
>>> ds.group1.shape
(20, 60, 60)
- class conninfpy.topologies.TopologyScenario(name: str, base_kind: str, mask_fn: ~typing.Callable[[...], ~numpy.ndarray], mask_params: ~typing.Dict[str, object] = <factory>, labels_fn: ~typing.Callable[[int, int], ~numpy.ndarray] = <function TopologyScenario.<lambda>>)[source]
Bases:
objectScenario specification: how to build labels + an effect mask topology.
mask_fn(labels, rng=…, **mask_params) returns a symmetric (N, N) matrix where: 0 means “no effect” and non-zero values scale the effect magnitude per edge.
labels_fn(n_nodes, n_modules) returns net_labels (shape (N,)).
- labels_fn(n_modules)
- with_mask_params(**overrides: object) TopologyScenario[source]
- class conninfpy.topologies.TopologyDataset(group1: ndarray, group2: ndarray, net_labels: ndarray, effect_mask: ndarray, effect_size: float, scenario: TopologyScenario, meta: Dict[str, object]=<factory>)[source]
Bases:
objectOutput of a topology simulation, ready for TFNBS/NBS pipelines.
group1/group2 are arrays of shape (n_samples, N, N) with zero diagonal.
net_labels can be passed to cNBS/NI/FBC methods.
effect_mask is the signed/weighted topology mask (not multiplied by effect_size).
- scenario: TopologyScenario
- class conninfpy.topologies.TopologyDatasetGenerator(n_nodes: int = 60, n_modules: int = 4, intra_corr: float = 0.3, inter_corr: float = 0.05, uniform_corr: float = 0.15, noise_level: float = 0.05, seed: int = 42)[source]
Bases:
objectReusable dataset generator for topology scenarios.
Example
>>> gen = TopologyDatasetGenerator(n_nodes=60, n_modules=4, seed=1) >>> ds = gen.generate("chain", effect_size=0.3, n_samples=20, time_points=30) >>> ds.group1.shape (20, 60, 60)
- conninfpy.topologies.get_scenarios() List[TopologyScenario][source]
- conninfpy.topologies.get_scenario(scenario: str | TopologyScenario) TopologyScenario[source]