# ckleiber/laminar architecture

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

- Interactive diagram: https://gitdiagram.com/ckleiber/laminar
- Repository: https://github.com/ckleiber/laminar

## Overview

LAMINAR is a Python manifold-learning package that uses an optimal-transport normalizing flow to induce a metric and builds a neighborhood graph for approximate distances and paths. Its main user workflow is to construct a LAMINAR model from data, transform points, form a graph, and query distances or fit smoothed geodesics. The excerpts support the graph and geodesic call relationships; model initialization and flow-training wiring are only partly shown, so those links are omitted. Utility coverage follows the source index and excerpts.

Main entry points: [`LAMINAR/LAMINAR/LAMINAR.py`](https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py) (LAMINAR API), [`LAMINAR/Flow/OTFlow.py`](https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py) (ODE integrator), [`LAMINAR/utils/gaussian2uniform.py`](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/gaussian2uniform.py) (Sphere transform), [`LAMINAR/utils/geodesics.py`](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/geodesics.py) (Geodesic regression)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Manifold model"]
  node_laminar["LAMINAR API<br/>[LAMINAR.py]"]
  node_standardize["Data standardization<br/>[standardize.py]"]
end

subgraph group_flow["Transport flow"]
  node_flowtrain["Flow training<br/>[OTFlow.py]"]
  node_objective["OT objective<br/>[OTFlow.py]"]
  node_integrator["ODE integrator<br/>[OTFlow.py]"]
  node_potential["Flow potential<br/>[OTFlow.py]"]
  node_resnet["Residual network<br/>[OTFlow.py]"]
  node_sphere["Sphere transform"]
end

subgraph group_graph["Graph distances"]
  node_graphbuild["Neighborhood graph<br/>[LAMINAR.py]"]
  node_graphquery["Graph queries<br/>[LAMINAR.py]"]
  node_shortest["Shortest paths<br/>[dijkstra.py]"]
end

subgraph group_geometry["Geodesic geometry"]
  node_geodesicfit["Geodesic fitting<br/>[LAMINAR.py]"]
  node_geodesicreg["Geodesic regression<br/>[geodesics.py]"]
  node_geodesicmetrics["Path metrics<br/>[geodesics.py]"]
  node_visualize["Metric visualization"]
end

node_user(("Data user"))

node_user -->|"provides data"| node_laminar
node_laminar -->|"transforms points"| node_integrator
node_laminar -->|"maps points"| node_sphere
node_laminar -->|"builds graph"| node_graphbuild
node_graphbuild -->|"transforms data"| node_integrator
node_graphbuild -->|"normalizes points"| node_sphere
node_laminar -->|"queries distances"| node_graphquery
node_graphquery -->|"computes paths"| node_shortest
node_laminar -->|"fits geodesics"| node_geodesicfit
node_geodesicfit -->|"gets initial path"| node_graphquery
node_geodesicfit -->|"fits regression"| node_geodesicreg
node_geodesicfit -->|"measures path"| node_geodesicmetrics
node_geodesicreg -->|"optimizes action"| node_geodesicmetrics
node_objective -->|"integrates flow"| node_integrator
node_flowtrain -->|"evaluates loss"| node_objective
node_integrator -->|"evaluates potential"| node_potential
node_potential -->|"uses network"| node_resnet
node_potential -->|"uses Jacobian"| node_sphere

click node_laminar "https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py"
click node_flowtrain "https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py"
click node_objective "https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py"
click node_integrator "https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py"
click node_potential "https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py"
click node_resnet "https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py"
click node_sphere "https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/gaussian2uniform.py"
click node_graphbuild "https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py"
click node_graphquery "https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py"
click node_shortest "https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/dijkstra.py"
click node_geodesicfit "https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py"
click node_geodesicreg "https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/geodesics.py"
click node_geodesicmetrics "https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/geodesics.py"
click node_standardize "https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/standardize.py"
click node_visualize "https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/tensor_visualisation.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_laminar,node_standardize,node_user toneBlue
class node_flowtrain,node_objective,node_integrator,node_potential,node_resnet,node_sphere toneAmber
class node_graphbuild,node_graphquery,node_shortest toneMint
class node_geodesicfit,node_geodesicreg,node_geodesicmetrics,node_visualize toneRose
```

## Components

### Manifold model

- [LAMINAR API](https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py): `LAMINAR/LAMINAR/LAMINAR.py`
- [Data standardization](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/standardize.py): `LAMINAR/utils/standardize.py`

### Transport flow

- [Flow training](https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py): `LAMINAR/Flow/OTFlow.py`
- [OT objective](https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py): `LAMINAR/Flow/OTFlow.py`
- [ODE integrator](https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py): `LAMINAR/Flow/OTFlow.py`
- [Flow potential](https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py): `LAMINAR/Flow/OTFlow.py`
- [Residual network](https://github.com/ckleiber/laminar/blob/main/LAMINAR/Flow/OTFlow.py): `LAMINAR/Flow/OTFlow.py`
- [Sphere transform](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/gaussian2uniform.py): `LAMINAR/utils/gaussian2uniform.py`

### Graph distances

- [Neighborhood graph](https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py): `LAMINAR/LAMINAR/LAMINAR.py`
- [Graph queries](https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py): `LAMINAR/LAMINAR/LAMINAR.py`
- [Shortest paths](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/dijkstra.py): `LAMINAR/utils/dijkstra.py`

### Geodesic geometry

- [Geodesic fitting](https://github.com/ckleiber/laminar/blob/main/LAMINAR/LAMINAR/LAMINAR.py): `LAMINAR/LAMINAR/LAMINAR.py`
- [Geodesic regression](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/geodesics.py): `LAMINAR/utils/geodesics.py`
- [Path metrics](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/geodesics.py): `LAMINAR/utils/geodesics.py`
- [Metric visualization](https://github.com/ckleiber/laminar/blob/main/LAMINAR/utils/tensor_visualisation.py): `LAMINAR/utils/tensor_visualisation.py`

### Other components

- **Data user**

## Connections

- Data user → LAMINAR API: provides data (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- LAMINAR API → ODE integrator: transforms points (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- LAMINAR API → Sphere transform: maps points (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- LAMINAR API → Neighborhood graph: builds graph (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Neighborhood graph → ODE integrator: transforms data (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Neighborhood graph → Sphere transform: normalizes points (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- LAMINAR API → Graph queries: queries distances (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Graph queries → Shortest paths: computes paths (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- LAMINAR API → Geodesic fitting: fits geodesics (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Geodesic fitting → Graph queries: gets initial path (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Geodesic fitting → Geodesic regression: fits regression (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Geodesic fitting → Path metrics: measures path (evidence: `LAMINAR/LAMINAR/LAMINAR.py`)
- Geodesic regression → Path metrics: optimizes action (evidence: `LAMINAR/utils/geodesics.py`)
- OT objective → ODE integrator: integrates flow (evidence: `LAMINAR/Flow/OTFlow.py`)
- Flow training → OT objective: evaluates loss (evidence: `LAMINAR/Flow/OTFlow.py`)
- ODE integrator → Flow potential: evaluates potential (evidence: `LAMINAR/Flow/OTFlow.py`)
- Flow potential → Residual network: uses network (evidence: `LAMINAR/Flow/OTFlow.py`)
- Flow potential → Sphere transform: uses Jacobian (evidence: `LAMINAR/Flow/OTFlow.py`)
