# smog-chalmers/pst architecture

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

- Interactive diagram: https://gitdiagram.com/smog-chalmers/pst
- Repository: https://github.com/smog-chalmers/pst

## Overview

PST combines a QGIS plugin with the Pstalgo C++ analysis library and its Python interface. The principal workflow is to choose an analysis in QGIS, provide network and optional destination data, run the corresponding Pstalgo operation, and display or write results as QGIS layers and columns. The library supports network construction, accessibility and centrality analyses, segment grouping, and visibility/isovist work. The graph preserves these documented capabilities; source excerpts are partial, so only explicit wiring is shown and unsampled subsystem links are omitted.

Main entry points: [`pstalgo/python/pstalgo/__init__.py`](https://github.com/smog-chalmers/pst/blob/master/pstalgo/python/pstalgo/__init__.py) (Python interface), [`pstqgis/src/pst/main.py`](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/main.py) (PST plugin), [`pstqgis/src/pst/analyses/attractiondistanceanalysis.py`](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/analyses/attractiondistanceanalysis.py) (QGIS analysis runs), [`pstqgis/src/pst/analyses/analysisdelegate.py`](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/analyses/analysisdelegate.py) (Analysis delegates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_qgis["QGIS interface"]
  node_plugin["PST plugin<br/>[main.py]"]
  node_wizards["Analysis wizards"]
  node_processing["Processing provider"]
  node_maptools["Isovist map tools"]
  node_analysisdelegate["Analysis delegates"]
end

subgraph group_gisdata["GIS data handling"]
  node_model["QGIS model<br/>[model.py]"]
  node_analysisruns["QGIS analysis runs"]
end

subgraph group_analysis["Analysis library"]
  node_pythonapi["Python interface<br/>[__init__.py]"]
  node_graphbuild["Network construction<br/>[CreateGraph.cpp]"]
  node_preprocess["Network preparation"]
  node_access["Reach and distance<br/>[Reach.cpp]"]
  node_centrality["Integration and betweenness"]
  node_segments["Segment analyses"]
  node_visibility["Visibility analyses"]
end

subgraph group_core["Graph and geometry"]
  node_graph["Axial graph<br/>[AxialGraph.cpp]"]
  node_bfs["Network traversal<br/>[BFS.cpp]"]
  node_distancegraph["Multi-distance graph"]
  node_geometry["Geometry algorithms"]
end

node_user(("QGIS user"))
node_qgis(("QGIS"))

node_user -->|"uses"| node_plugin
node_plugin -->|"opens"| node_wizards
node_plugin -->|"registers"| node_processing
node_plugin -.->|"enables tools"| node_maptools
node_wizards -->|"dispatches"| node_analysisdelegate
node_processing -->|"delegates"| node_analysisdelegate
node_analysisdelegate -->|"runs"| node_analysisruns
node_analysisruns -->|"reads inputs"| node_model
node_analysisruns -->|"writes results"| node_model
node_analysisruns -->|"calls"| node_pythonapi
node_pythonapi -->|"invokes"| node_graphbuild
node_pythonapi -->|"invokes"| node_access
node_pythonapi -->|"invokes"| node_centrality
node_pythonapi -->|"invokes"| node_segments
node_pythonapi -->|"invokes"| node_visibility
node_graphbuild -->|"builds"| node_graph
node_access -->|"traverses"| node_bfs
node_centrality -->|"traverses"| node_bfs
node_visibility -->|"uses"| node_geometry
node_maptools -.->|"uses"| node_pythonapi
node_plugin -->|"integrates with"| node_qgis

click node_plugin "https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/main.py"
click node_wizards "https://github.com/smog-chalmers/pst/tree/master/pstqgis/src/pst/ui/wizards"
click node_processing "https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/processing/pst_processing_provider.py"
click node_maptools "https://github.com/smog-chalmers/pst/tree/master/pstqgis/src/pst/maptools/isovist"
click node_analysisdelegate "https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/analyses/analysisdelegate.py"
click node_model "https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/model/model.py"
click node_analysisruns "https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/analyses/attractiondistanceanalysis.py"
click node_pythonapi "https://github.com/smog-chalmers/pst/blob/master/pstalgo/python/pstalgo/__init__.py"
click node_graphbuild "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/CreateGraph.cpp"
click node_preprocess "https://github.com/smog-chalmers/pst/tree/master/pstalgo/src/analyses"
click node_access "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/Reach.cpp"
click node_centrality "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/NetworkIntegration.cpp"
click node_segments "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/SegmentGrouping.cpp"
click node_visibility "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/CalculateIsovists.cpp"
click node_graph "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/graph/AxialGraph.cpp"
click node_bfs "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/BFS.cpp"
click node_distancegraph "https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/experimental/DirectedMultiDistanceGraph.cpp"
click node_geometry "https://github.com/smog-chalmers/pst/tree/master/pstalgo/src/geometry"

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_plugin,node_wizards,node_processing,node_maptools,node_analysisdelegate,node_user toneBlue
class node_model,node_analysisruns toneAmber
class node_pythonapi,node_graphbuild,node_preprocess,node_access,node_centrality,node_segments,node_visibility toneMint
class node_graph,node_bfs,node_distancegraph,node_geometry toneRose
class node_qgis toneIndigo
```

## Components

### QGIS interface

- [PST plugin](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/main.py): `pstqgis/src/pst/main.py`
- [Analysis wizards](https://github.com/smog-chalmers/pst/tree/master/pstqgis/src/pst/ui/wizards): `pstqgis/src/pst/ui/wizards`
- [Processing provider](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/processing/pst_processing_provider.py): `pstqgis/src/pst/processing/pst_processing_provider.py`
- [Isovist map tools](https://github.com/smog-chalmers/pst/tree/master/pstqgis/src/pst/maptools/isovist): `pstqgis/src/pst/maptools/isovist`
- [Analysis delegates](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/analyses/analysisdelegate.py): `pstqgis/src/pst/analyses/analysisdelegate.py`

### GIS data handling

- [QGIS model](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/model/model.py): `pstqgis/src/pst/model/model.py`
- [QGIS analysis runs](https://github.com/smog-chalmers/pst/blob/master/pstqgis/src/pst/analyses/attractiondistanceanalysis.py): `pstqgis/src/pst/analyses/attractiondistanceanalysis.py`

### Analysis library

- [Python interface](https://github.com/smog-chalmers/pst/blob/master/pstalgo/python/pstalgo/__init__.py): `pstalgo/python/pstalgo/__init__.py`
- [Network construction](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/CreateGraph.cpp): `pstalgo/src/analyses/CreateGraph.cpp`
- [Network preparation](https://github.com/smog-chalmers/pst/tree/master/pstalgo/src/analyses): `pstalgo/src/analyses`
- [Reach and distance](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/Reach.cpp): `pstalgo/src/analyses/Reach.cpp`
- [Integration and betweenness](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/NetworkIntegration.cpp): `pstalgo/src/analyses/NetworkIntegration.cpp`
- [Segment analyses](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/SegmentGrouping.cpp): `pstalgo/src/analyses/SegmentGrouping.cpp`
- [Visibility analyses](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/analyses/CalculateIsovists.cpp): `pstalgo/src/analyses/CalculateIsovists.cpp`

### Graph and geometry

- [Axial graph](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/graph/AxialGraph.cpp): `pstalgo/src/graph/AxialGraph.cpp`
- [Network traversal](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/BFS.cpp): `pstalgo/src/BFS.cpp`
- [Multi-distance graph](https://github.com/smog-chalmers/pst/blob/master/pstalgo/src/experimental/DirectedMultiDistanceGraph.cpp): `pstalgo/src/experimental/DirectedMultiDistanceGraph.cpp`
- [Geometry algorithms](https://github.com/smog-chalmers/pst/tree/master/pstalgo/src/geometry): `pstalgo/src/geometry`

### Other components

- **QGIS user**
- **QGIS**

## Connections

- QGIS user → PST plugin: uses
- PST plugin → Analysis wizards: opens
- PST plugin → Processing provider: registers
- PST plugin → Isovist map tools: enables tools
- Analysis wizards → Analysis delegates: dispatches
- Processing provider → Analysis delegates: delegates
- Analysis delegates → QGIS analysis runs: runs
- QGIS analysis runs → QGIS model: reads inputs
- QGIS analysis runs → QGIS model: writes results
- QGIS analysis runs → Python interface: calls
- Python interface → Network construction: invokes
- Python interface → Reach and distance: invokes
- Python interface → Integration and betweenness: invokes
- Python interface → Segment analyses: invokes
- Python interface → Visibility analyses: invokes
- Network construction → Axial graph: builds
- Reach and distance → Network traversal: traverses
- Integration and betweenness → Network traversal: traverses
- Visibility analyses → Geometry algorithms: uses
- Isovist map tools → Python interface: uses
- PST plugin → QGIS: integrates with
