# bj-noh/trajectory-resynthesis architecture

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

- Interactive diagram: https://gitdiagram.com/bj-noh/trajectory-resynthesis
- Repository: https://github.com/bj-noh/trajectory-resynthesis

## Overview

This repository is a set of trajectory-resynthesis research pipelines: graph-based variational autoencoders (VGAE) and a latent-diffusion model, each with fixed-topology and vehicle-count-agnostic variants, plus an ablation. The principal workflow reads scenario data, builds and batches graph sequences, trains a model, then evaluates or samples trajectories and saves results. The excerpts show orchestration and parts of the fixed VGAE and proposed model; the SOURCE INDEX supports some additional module relationships. Other variant internals are not fully shown, so their links are omitted where unverified.

Main entry points: [`code/VGAE_fixed/main.py`](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/main.py) (Fixed VGAE runner), [`code/proposed_fixed/main.py`](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/main.py) (Fixed diffusion runner), [`code/proposed_fixed/model.py`](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/model.py) (Trajectory generator), [`code/proposed_agnostic_ablation/model.py`](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/model.py) (Ablation generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Scenario input"]
  node_vgae_fixed_pre["Fixed graph preparation<br/>[preprocessing.py]"]
  node_vgae_fixed_data["Fixed scenario batches<br/>[dataset.py]"]
  node_prop_fixed_pre["Fixed graph preparation<br/>[preprocessing.py]"]
  node_prop_fixed_data["Fixed scenario batches<br/>[dataset.py]"]
end

subgraph group_vgae["Graph VAE"]
  node_vgae_fixed_main["Fixed VGAE runner<br/>[main.py]"]
  node_vgae_fixed_train["Fixed VGAE trainer<br/>[train.py]"]
  node_vgae_fixed_vae["Fixed graph VAE<br/>[VAE.py]"]
end

subgraph group_diffusion["Latent diffusion"]
  node_prop_fixed_main["Fixed diffusion runner<br/>[main.py]"]
  node_prop_fixed_train["Latent alignment trainer"]
  node_prop_fixed_model["Trajectory generator<br/>[model.py]"]
  node_prop_fixed_belief["Belief conditioning<br/>[belief_state.py]"]
  node_prop_fixed_ditto["DiTTO diffusion<br/>[Ditto.py]"]
  node_prop_fixed_dit["Diffusion transformer<br/>[DiT.py]"]
end

subgraph group_variants["Model variants"]
  node_vgae_agnostic["Agnostic VGAE pipeline"]
  node_prop_agnostic["Agnostic diffusion pipeline"]
  node_prop_ablation_main["Ablation runner<br/>[main.py]"]
  node_prop_ablation_train["Ablation trainer"]
  node_prop_ablation_model["Ablation generator<br/>[model.py]"]
  node_prop_ablation_ditto["Ablation DiTTO<br/>[Ditto.py]"]
  node_ablation_inference["Ablation inference<br/>[inference.py]"]
  node_ablation_calculate["Ablation calculations<br/>[calculate.py]"]
end

node_engineer(("Research user"))
node_csv["Scenario CSV"]

node_engineer -.->|"runs pipeline"| node_vgae_fixed_main
node_csv -->|"loads scenarios"| node_vgae_fixed_main
node_vgae_fixed_main -->|"builds graph splits"| node_vgae_fixed_pre
node_vgae_fixed_main -->|"creates loaders"| node_vgae_fixed_data
node_vgae_fixed_main -->|"trains and evaluates"| node_vgae_fixed_train
node_vgae_fixed_train -->|"uses model"| node_vgae_fixed_vae
node_engineer -.->|"runs pipeline"| node_prop_fixed_main
node_csv -->|"loads scenarios"| node_prop_fixed_main
node_prop_fixed_main -->|"builds graph splits"| node_prop_fixed_pre
node_prop_fixed_main -->|"creates loaders"| node_prop_fixed_data
node_prop_fixed_main -->|"trains and evaluates"| node_prop_fixed_train
node_prop_fixed_train -->|"trains and samples"| node_prop_fixed_model
node_prop_fixed_model -->|"builds belief tokens"| node_prop_fixed_belief
node_prop_fixed_model -->|"predicts diffusion"| node_prop_fixed_ditto
node_prop_fixed_ditto -->|"uses transformer"| node_prop_fixed_dit
node_prop_agnostic -.->|"imports generator"| node_prop_fixed_model
node_engineer -.->|"runs ablation"| node_prop_ablation_main
node_prop_ablation_main -->|"trains and evaluates"| node_prop_ablation_train
node_prop_ablation_train -.->|"trains and samples"| node_prop_ablation_model
node_prop_ablation_model -.->|"uses diffusion"| node_prop_ablation_ditto
node_ablation_inference -.->|"runs inference"| node_prop_ablation_model
node_ablation_calculate -.->|"analyzes outputs"| node_prop_ablation_model
node_engineer -.->|"runs variant"| node_vgae_agnostic

click node_vgae_fixed_main "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/main.py"
click node_vgae_fixed_pre "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/preprocessing.py"
click node_vgae_fixed_data "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/dataset.py"
click node_vgae_fixed_train "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/train.py"
click node_vgae_fixed_vae "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/VAE.py"
click node_vgae_agnostic "https://github.com/bj-noh/trajectory-resynthesis/tree/main/code/VGAE_agnostic"
click node_prop_fixed_main "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/main.py"
click node_prop_fixed_pre "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/preprocessing.py"
click node_prop_fixed_data "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/dataset.py"
click node_prop_fixed_train "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/train_latent_align.py"
click node_prop_fixed_model "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/model.py"
click node_prop_fixed_belief "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/belief_state.py"
click node_prop_fixed_ditto "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/Ditto.py"
click node_prop_fixed_dit "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/DiT.py"
click node_prop_agnostic "https://github.com/bj-noh/trajectory-resynthesis/tree/main/code/proposed_agnostic"
click node_prop_ablation_main "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/main.py"
click node_prop_ablation_train "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/train_latent_align.py"
click node_prop_ablation_model "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/model.py"
click node_prop_ablation_ditto "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/Ditto.py"
click node_ablation_inference "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/inference.py"
click node_ablation_calculate "https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/calculate.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_vgae_fixed_pre,node_vgae_fixed_data,node_prop_fixed_pre,node_prop_fixed_data,node_engineer toneBlue
class node_vgae_fixed_main,node_vgae_fixed_train,node_vgae_fixed_vae toneAmber
class node_prop_fixed_main,node_prop_fixed_train,node_prop_fixed_model,node_prop_fixed_belief,node_prop_fixed_ditto,node_prop_fixed_dit toneMint
class node_vgae_agnostic,node_prop_agnostic,node_prop_ablation_main,node_prop_ablation_train,node_prop_ablation_model,node_prop_ablation_ditto,node_ablation_inference,node_ablation_calculate toneRose
class node_csv toneIndigo
```

## Components

### Scenario input

- [Fixed graph preparation](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/preprocessing.py): `code/VGAE_fixed/preprocessing.py`
- [Fixed scenario batches](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/dataset.py): `code/VGAE_fixed/dataset.py`
- [Fixed graph preparation](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/preprocessing.py): `code/proposed_fixed/preprocessing.py`
- [Fixed scenario batches](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/dataset.py): `code/proposed_fixed/dataset.py`

### Graph VAE

- [Fixed VGAE runner](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/main.py): `code/VGAE_fixed/main.py`
- [Fixed VGAE trainer](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/train.py): `code/VGAE_fixed/train.py`
- [Fixed graph VAE](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/VGAE_fixed/VAE.py): `code/VGAE_fixed/VAE.py`

### Latent diffusion

- [Fixed diffusion runner](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/main.py): `code/proposed_fixed/main.py`
- [Latent alignment trainer](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/train_latent_align.py): `code/proposed_fixed/train_latent_align.py`
- [Trajectory generator](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/model.py): `code/proposed_fixed/model.py`
- [Belief conditioning](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/belief_state.py): `code/proposed_fixed/belief_state.py`
- [DiTTO diffusion](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/Ditto.py): `code/proposed_fixed/Ditto.py`
- [Diffusion transformer](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_fixed/DiT.py): `code/proposed_fixed/DiT.py`

### Model variants

- [Agnostic VGAE pipeline](https://github.com/bj-noh/trajectory-resynthesis/tree/main/code/VGAE_agnostic): `code/VGAE_agnostic`
- [Agnostic diffusion pipeline](https://github.com/bj-noh/trajectory-resynthesis/tree/main/code/proposed_agnostic): `code/proposed_agnostic`
- [Ablation runner](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/main.py): `code/proposed_agnostic_ablation/main.py`
- [Ablation trainer](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/train_latent_align.py): `code/proposed_agnostic_ablation/train_latent_align.py`
- [Ablation generator](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/model.py): `code/proposed_agnostic_ablation/model.py`
- [Ablation DiTTO](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/Ditto.py): `code/proposed_agnostic_ablation/Ditto.py`
- [Ablation inference](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/inference.py): `code/proposed_agnostic_ablation/inference.py`
- [Ablation calculations](https://github.com/bj-noh/trajectory-resynthesis/blob/main/code/proposed_agnostic_ablation/calculate.py): `code/proposed_agnostic_ablation/calculate.py`

### Other components

- **Research user**
- **Scenario CSV**

## Connections

- Research user → Fixed VGAE runner: runs pipeline
- Scenario CSV → Fixed VGAE runner: loads scenarios (evidence: `code/VGAE_fixed/main.py`)
- Fixed VGAE runner → Fixed graph preparation: builds graph splits (evidence: `code/VGAE_fixed/main.py`)
- Fixed VGAE runner → Fixed scenario batches: creates loaders (evidence: `code/VGAE_fixed/main.py`)
- Fixed VGAE runner → Fixed VGAE trainer: trains and evaluates (evidence: `code/VGAE_fixed/main.py`)
- Fixed VGAE trainer → Fixed graph VAE: uses model (evidence: `code/VGAE_fixed/train.py`)
- Research user → Fixed diffusion runner: runs pipeline
- Scenario CSV → Fixed diffusion runner: loads scenarios (evidence: `code/proposed_fixed/main.py`)
- Fixed diffusion runner → Fixed graph preparation: builds graph splits (evidence: `code/proposed_fixed/main.py`)
- Fixed diffusion runner → Fixed scenario batches: creates loaders (evidence: `code/proposed_fixed/main.py`)
- Fixed diffusion runner → Latent alignment trainer: trains and evaluates (evidence: `code/proposed_fixed/main.py`)
- Latent alignment trainer → Trajectory generator: trains and samples (evidence: `code/proposed_fixed/train_latent_align.py`)
- Trajectory generator → Belief conditioning: builds belief tokens (evidence: `code/proposed_fixed/model.py`)
- Trajectory generator → DiTTO diffusion: predicts diffusion (evidence: `code/proposed_fixed/model.py`)
- DiTTO diffusion → Diffusion transformer: uses transformer (evidence: `code/proposed_fixed/Ditto.py`)
- Agnostic diffusion pipeline → Trajectory generator: imports generator (evidence: `code/proposed_agnostic/train_latent_align.py`)
- Research user → Ablation runner: runs ablation
- Ablation runner → Ablation trainer: trains and evaluates (evidence: `code/proposed_agnostic_ablation/main.py`)
- Ablation trainer → Ablation generator: trains and samples
- Ablation generator → Ablation DiTTO: uses diffusion
- Ablation inference → Ablation generator: runs inference
- Ablation calculations → Ablation generator: analyzes outputs
- Research user → Agnostic VGAE pipeline: runs variant
