# gabrielecerioli/inverse_inference_weighted_spatio_functional_networks architecture

> Architecture diagram of the GitHub repository gabrielecerioli/inverse_inference_weighted_spatio_functional_networks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks
- Repository: https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks
- Video tour (about a minute): https://gitdiagram.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/video

## Overview

This is a research implementation for generating synthetic spatio-functional networks and estimating their physical/social mixing parameter, physical interaction scale, and latent coordinates. Users can generate benchmark networks, run exact inference (including optional profile-likelihood uncertainty), or estimate large-network parameters by fitting independent induced subnetworks and aggregating their results. The graph reflects README-described capabilities and sampled source; generator metric evaluation is documented, but some implementation details were not sampled.

Main entry points: [`exact_inference.py`](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py) (Exact inference), [`subsampled_inference.py`](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py) (Subsampled inference), [`spatiosocial_network_generator.py`](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py) (Network generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Network generation"]
  node_generator["Network generator"]
  node_gmm["Social GMM"]
  node_coordinates["Physical coordinates"]
  node_dual_kernel["Dual kernels"]
  node_propensity["Balanced propensity"]
  node_link_sampling["Link sampling"]
  node_network["Synthetic network"]
end

subgraph group_exact["Exact inference"]
  node_exact_api["Exact inference<br/>[exact_inference.py]"]
  node_distance_baseline["Distance and r₀<br/>[exact_inference.py]"]
  node_spectral_init["Spectral initialization<br/>[exact_inference.py]"]
  node_objective["Poisson objective<br/>[exact_inference.py]"]
  node_optimization["Hybrid optimization<br/>[exact_inference.py]"]
  node_profile_ci["Profile confidence interval<br/>[exact_inference.py]"]
  node_estimates["Parameter estimates<br/>[exact_inference.py]"]
end

subgraph group_ensemble["Subsampled inference"]
  node_subsampled_api["Subsampled inference"]
  node_sampling["Subgraph sampling"]
  node_aggregation["Ensemble aggregation"]
  node_ensemble_results["Ensemble estimates"]
end

subgraph group_evaluation["Latent evaluation"]
  node_alignment["Procrustes alignment"]
  node_metric_deficit["Metric deficit"]
end

node_user(("Research user"))

node_user -->|"requests generation"| node_generator
node_generator -->|"samples latent positions"| node_gmm
node_generator -->|"samples locations"| node_coordinates
node_generator -->|"combines coordinates"| node_dual_kernel
node_dual_kernel -->|"forms raw weights"| node_propensity
node_propensity -->|"sets expected intensity"| node_link_sampling
node_link_sampling -->|"samples links"| node_network
node_user -->|"requests inference"| node_exact_api
node_exact_api -->|"computes distances and r₀"| node_distance_baseline
node_exact_api -->|"initializes latent positions"| node_spectral_init
node_exact_api -->|"defines likelihood"| node_objective
node_exact_api -->|"optimizes parameters"| node_optimization
node_optimization -->|"evaluates objective"| node_objective
node_exact_api -->|"optionally profiles lambda"| node_profile_ci
node_exact_api -->|"returns estimates"| node_estimates
node_user -->|"requests ensemble fit"| node_subsampled_api
node_subsampled_api -->|"selects induced subgraphs"| node_sampling
node_sampling -->|"provides subgraph inputs"| node_subsampled_api
node_subsampled_api -->|"fits each subgraph"| node_exact_api
node_subsampled_api -->|"aggregates replica fits"| node_aggregation
node_aggregation -->|"returns means and errors"| node_ensemble_results
node_user -->|"requests coordinate alignment"| node_alignment
node_user -->|"requests metric evaluation"| node_metric_deficit

click node_generator "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_gmm "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_coordinates "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_dual_kernel "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_propensity "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_link_sampling "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_network "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_exact_api "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_distance_baseline "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_spectral_init "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_objective "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_optimization "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_profile_ci "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_estimates "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py"
click node_subsampled_api "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py"
click node_sampling "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py"
click node_aggregation "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py"
click node_ensemble_results "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py"
click node_alignment "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"
click node_metric_deficit "https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_generator,node_gmm,node_coordinates,node_dual_kernel,node_propensity,node_link_sampling,node_network,node_user toneBlue
class node_exact_api,node_distance_baseline,node_spectral_init,node_objective,node_optimization,node_profile_ci,node_estimates toneAmber
class node_subsampled_api,node_sampling,node_aggregation,node_ensemble_results toneMint
class node_alignment,node_metric_deficit toneRose
```

## Components

### Network generation

- [Network generator](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Social GMM](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Physical coordinates](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Dual kernels](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Balanced propensity](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Link sampling](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Synthetic network](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`

### Exact inference

- [Exact inference](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`
- [Distance and r₀](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`
- [Spectral initialization](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`
- [Poisson objective](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`
- [Hybrid optimization](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`
- [Profile confidence interval](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`
- [Parameter estimates](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/exact_inference.py): `exact_inference.py`

### Subsampled inference

- [Subsampled inference](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py): `subsampled_inference.py`
- [Subgraph sampling](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py): `subsampled_inference.py`
- [Ensemble aggregation](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py): `subsampled_inference.py`
- [Ensemble estimates](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/subsampled_inference.py): `subsampled_inference.py`

### Latent evaluation

- [Procrustes alignment](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`
- [Metric deficit](https://github.com/gabrielecerioli/inverse_inference_weighted_spatio_functional_networks/blob/main/spatiosocial_network_generator.py): `spatiosocial_network_generator.py`

### Other components

- **Research user**

## Connections

- Research user → Network generator: requests generation
- Network generator → Social GMM: samples latent positions
- Network generator → Physical coordinates: samples locations
- Network generator → Dual kernels: combines coordinates
- Dual kernels → Balanced propensity: forms raw weights
- Balanced propensity → Link sampling: sets expected intensity
- Link sampling → Synthetic network: samples links
- Research user → Exact inference: requests inference
- Exact inference → Distance and r₀: computes distances and r₀
- Exact inference → Spectral initialization: initializes latent positions
- Exact inference → Poisson objective: defines likelihood
- Exact inference → Hybrid optimization: optimizes parameters
- Hybrid optimization → Poisson objective: evaluates objective
- Exact inference → Profile confidence interval: optionally profiles lambda
- Exact inference → Parameter estimates: returns estimates
- Research user → Subsampled inference: requests ensemble fit
- Subsampled inference → Subgraph sampling: selects induced subgraphs
- Subgraph sampling → Subsampled inference: provides subgraph inputs
- Subsampled inference → Exact inference: fits each subgraph
- Subsampled inference → Ensemble aggregation: aggregates replica fits
- Ensemble aggregation → Ensemble estimates: returns means and errors
- Research user → Procrustes alignment: requests coordinate alignment
- Research user → Metric deficit: requests metric evaluation
