# zerocloud-jasmine/nanchang-guide architecture

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

- Interactive diagram: https://gitdiagram.com/zerocloud-jasmine/nanchang-guide
- Repository: https://github.com/zerocloud-jasmine/nanchang-guide

## Overview

This is a C++ console prototype for querying and simulating routes among selected Nanchang attractions. The user enters through the console menu, which supports attraction and road management, lookup/filtering, graph traversal, and route requests. Route requests select distance, time, or hop count, then use Dijkstra or Floyd and reconstruct a displayable path. Startup loads runtime data with a documented fallback to defaults; edits can be saved. The README describes a future EasyX interface, but the sampled code does not establish an implemented graphical workflow, so it is omitted.

Main entry points: [`src/graph.cpp`](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/graph.cpp) (Weighted graph), [`src/interface.cpp`](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp) (Console menu), [`src/algorithm.cpp`](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp) (Path reconstruction), [`src/storage.cpp`](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/storage.cpp) (Startup loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Console interaction"]
  node_console["Console menu<br/>[interface.cpp]"]
  node_spot_ops["Spot queries and edits<br/>[interface.cpp]"]
  node_road_ops["Road edits<br/>[interface.cpp]"]
  node_route_request["Route request<br/>[interface.cpp]"]
end

subgraph group_domain["Attraction graph"]
  node_graph["Weighted graph<br/>[graph.cpp]"]
end

subgraph group_routing["Traversal and routing"]
  node_traversal["DFS and BFS<br/>[algorithm.cpp]"]
  node_dijkstra["Dijkstra routing<br/>[algorithm.cpp]"]
  node_floyd["Floyd routing<br/>[algorithm.cpp]"]
  node_path_build["Path reconstruction<br/>[algorithm.cpp]"]
end

subgraph group_persistence["Local data"]
  node_startup["Startup loader<br/>[storage.cpp]"]
  node_text_store[("Text data files")]
  node_runtime_store[("Runtime data files")]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_console
node_console -->|"dispatches"| node_spot_ops
node_console -->|"dispatches"| node_road_ops
node_console -->|"dispatches"| node_route_request
node_spot_ops -->|"queries and edits"| node_graph
node_road_ops -->|"edits"| node_graph
node_route_request -->|"runs optionally"| node_dijkstra
node_route_request -->|"runs optionally"| node_floyd
node_route_request -->|"requests path"| node_path_build
node_route_request -->|"requests traversal"| node_traversal
node_traversal -->|"reads graph"| node_graph
node_dijkstra -->|"reads graph"| node_graph
node_floyd -->|"reads graph"| node_graph
node_path_build -->|"reads graph"| node_graph
node_path_build -->|"uses results"| node_dijkstra
node_path_build -->|"uses results"| node_floyd
node_startup -->|"loads fallback"| node_text_store
node_startup -->|"loads first"| node_runtime_store
node_startup -->|"populates"| node_graph
node_console -->|"saves edits"| node_runtime_store

click node_console "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp"
click node_spot_ops "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp"
click node_road_ops "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp"
click node_route_request "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp"
click node_graph "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/graph.cpp"
click node_traversal "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp"
click node_dijkstra "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp"
click node_floyd "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp"
click node_path_build "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp"
click node_startup "https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/storage.cpp"
click node_text_store "https://github.com/zerocloud-jasmine/nanchang-guide/tree/main/data/default"
click node_runtime_store "https://github.com/zerocloud-jasmine/nanchang-guide/tree/main/data/runtime"

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_console,node_spot_ops,node_road_ops,node_route_request toneBlue
class node_graph toneAmber
class node_traversal,node_dijkstra,node_floyd,node_path_build toneMint
class node_startup,node_text_store,node_runtime_store toneRose
class node_visitor toneIndigo
```

## Components

### Console interaction

- [Console menu](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp): `src/interface.cpp`
- [Spot queries and edits](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp): `src/interface.cpp`
- [Road edits](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp): `src/interface.cpp`
- [Route request](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/interface.cpp): `src/interface.cpp`

### Attraction graph

- [Weighted graph](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/graph.cpp): `src/graph.cpp`

### Traversal and routing

- [DFS and BFS](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp): `src/algorithm.cpp`
- [Dijkstra routing](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp): `src/algorithm.cpp`
- [Floyd routing](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp): `src/algorithm.cpp`
- [Path reconstruction](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/algorithm.cpp): `src/algorithm.cpp`

### Local data

- [Startup loader](https://github.com/zerocloud-jasmine/nanchang-guide/blob/main/src/storage.cpp): `src/storage.cpp`
- [Text data files](https://github.com/zerocloud-jasmine/nanchang-guide/tree/main/data/default): `data/default`
- [Runtime data files](https://github.com/zerocloud-jasmine/nanchang-guide/tree/main/data/runtime): `data/runtime`

### Other components

- **Visitor**

## Connections

- Visitor → Console menu: uses (evidence: `README.md`)
- Console menu → Spot queries and edits: dispatches (evidence: `src/interface.cpp`)
- Console menu → Road edits: dispatches (evidence: `src/interface.cpp`)
- Console menu → Route request: dispatches (evidence: `src/interface.cpp`)
- Spot queries and edits → Weighted graph: queries and edits (evidence: `src/interface.cpp`)
- Road edits → Weighted graph: edits (evidence: `src/interface.cpp`)
- Route request → Dijkstra routing: runs optionally (evidence: `src/interface.cpp`)
- Route request → Floyd routing: runs optionally (evidence: `src/interface.cpp`)
- Route request → Path reconstruction: requests path (evidence: `src/interface.cpp`)
- Route request → DFS and BFS: requests traversal (evidence: `README.md`)
- DFS and BFS → Weighted graph: reads graph (evidence: `src/algorithm.cpp`)
- Dijkstra routing → Weighted graph: reads graph (evidence: `src/algorithm.cpp`)
- Floyd routing → Weighted graph: reads graph (evidence: `src/algorithm.cpp`)
- Path reconstruction → Weighted graph: reads graph (evidence: `src/algorithm.cpp`)
- Path reconstruction → Dijkstra routing: uses results (evidence: `src/algorithm.cpp`)
- Path reconstruction → Floyd routing: uses results (evidence: `src/algorithm.cpp`)
- Startup loader → Text data files: loads fallback (evidence: `README.md`)
- Startup loader → Runtime data files: loads first (evidence: `README.md`)
- Startup loader → Weighted graph: populates (evidence: `src/storage.cpp`)
- Console menu → Runtime data files: saves edits (evidence: `src/interface.cpp`)
