# dilli-k/geographic-path-finder architecture

> Architecture diagram of the GitHub repository dilli-k/geographic-path-finder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dilli-k/geographic-path-finder
- Repository: https://github.com/dilli-k/geographic-path-finder

## Overview

##### File structure
- Top‐level files and dirs:
- index.html + public/ → static assets (map style, manifest, tutorial videos)
- src/ → application code
– components/ → React UI components (App, Map, Interface, Slider, GraphDebug)
– services/ → MapService for loading or generating graph/map data
– models/ → domain models (Node, Edge, Graph, PathfindingState) and algorithm implementations
– hooks/ → a custom hook (useSmoothStateChange) for animating state transitions
– api.js & config.js & helpers.js → utilities for fetching data and configuration
– main.jsx & index.scss → app entrypoint and global styling
- Configuration: vite.config.js, package.json, ESLint, editorconfig

##### README
- Confirms available algorithms and standard npm install + vite dev flow
- No backend or database—pure front-end visualization tool

##### Elements
- From Browser UI → Service → Domain → Algorithm → Hook → UI render
- Green for Services
- Orange for Domain models
- Red for Algorithms
- Gray for Utilities

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["Browser / Client"]:::frontend
        App["App Component"]:::frontend
        MapComp["Map Visualization Component"]:::frontend
        Interface["Interface Controls Component"]:::frontend
        Slider["Slider Control Component"]:::frontend
        GraphDebug["Debug Visualization Component"]:::frontend
    end

    %% Service Layer
    subgraph "Service Layer"
        direction TB
        MapService["MapService"]:::service
        APIUtil["API Utilities (api.js)"]:::service
    end

    %% Domain Model Layer
    subgraph "Domain Model Layer"
        direction TB
        GraphModel["Graph Model"]:::domain
        NodeModel["Node Model"]:::domain
        EdgeModel["Edge Model"]:::domain
        PathState["PathfindingState Model"]:::domain
    end

    %% Algorithm Layer
    subgraph "Algorithm Layer"
        direction TB
        BaseAlgo["PathfindingAlgorithm Interface"]:::algorithm
        AStar["A* Algorithm"]:::algorithm
        Dijkstra["Dijkstra Algorithm"]:::algorithm
        Greedy["Greedy Best-First Algorithm"]:::algorithm
        BiDir["Bidirectional Search Algorithm"]:::algorithm
    end

    %% Utility Layer
    subgraph "Utility Layer"
        direction TB
        Hook["useSmoothStateChange Hook"]:::utility
        Helpers["General Helpers"]:::utility
        Config["Configuration Constants"]:::utility
        EntryJS["Application Entrypoint (main.jsx)"]:::utility
        Styles["Global Stylesheet (index.scss)"]:::utility
    end

    %% Static Assets
    subgraph "Static Assets"
        direction TB
        MapStyle["map_style.json"]:::asset
        WebManifest["site.webmanifest"]:::asset
        BrowserCfg["browserconfig.xml"]:::asset
        Videos["videos/ (tutorial MP4s)"]:::asset
    end

    %% Relationships
    Browser -->|loads| App
    App -->|renders| Interface
    App -->|renders| MapComp
    Interface -->|uses| Slider
    Interface -->|triggers| MapService
    MapComp -->|requests graph| MapService
    MapService -->|fetches| APIUtil
    APIUtil -->|returns JSON| GraphModel
    GraphModel -->|builds nodes| NodeModel
    GraphModel -->|builds edges| EdgeModel
    GraphModel -->|produces| PathState
    PathState -->|feeds| BaseAlgo
    BaseAlgo -->|implemented by| AStar
    BaseAlgo -->|implemented by| Dijkstra
    BaseAlgo -->|implemented by| Greedy
    BaseAlgo -->|implemented by| BiDir
    AStar -->|emits states| PathState
    Dijkstra -->|emits states| PathState
    Greedy -->|emits states| PathState
    BiDir -->|emits states| PathState
    PathState -->|animates via| Hook
    Hook -->|updates| MapComp
    Hook -->|updates| GraphDebug
    Helpers -->|provides utils| MapService
    Config -->|provides constants| Helpers
    EntryJS -->|boots app| App
    Styles -->|styles| App
    MapStyle -->|used by| MapComp
    WebManifest -->|defines| Browser
    BrowserCfg -->|configures| Browser
    Videos -->|accessed by| Interface

    %% Click Events
    click Browser "https://github.com/dilli-k/geographic-path-finder/blob/main/index.html"
    click App "https://github.com/dilli-k/geographic-path-finder/blob/main/src/components/App.jsx"
    click MapComp "https://github.com/dilli-k/geographic-path-finder/blob/main/src/components/Map.jsx"
    click Interface "https://github.com/dilli-k/geographic-path-finder/blob/main/src/components/Interface.jsx"
    click Slider "https://github.com/dilli-k/geographic-path-finder/blob/main/src/components/Slider.jsx"
    click GraphDebug "https://github.com/dilli-k/geographic-path-finder/blob/main/src/components/GraphDebug.jsx"
    click MapService "https://github.com/dilli-k/geographic-path-finder/blob/main/src/services/MapService.js"
    click APIUtil "https://github.com/dilli-k/geographic-path-finder/blob/main/src/api.js"
    click GraphModel "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/Graph.js"
    click NodeModel "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/Node.js"
    click EdgeModel "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/Edge.js"
    click PathState "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/PathfindingState.js"
    click BaseAlgo "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/algorithms/PathfindingAlgorithm.js"
    click AStar "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/algorithms/AStar.js"
    click Dijkstra "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/algorithms/Dijkstra.js"
    click Greedy "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/algorithms/Greedy.js"
    click BiDir "https://github.com/dilli-k/geographic-path-finder/blob/main/src/models/algorithms/BidirectionalSearch.js"
    click Hook "https://github.com/dilli-k/geographic-path-finder/blob/main/src/hooks/useSmoothStateChange.jsx"
    click Helpers "https://github.com/dilli-k/geographic-path-finder/blob/main/src/helpers.js"
    click Config "https://github.com/dilli-k/geographic-path-finder/blob/main/src/config.js"
    click EntryJS "https://github.com/dilli-k/geographic-path-finder/blob/main/src/main.jsx"
    click Styles "https://github.com/dilli-k/geographic-path-finder/blob/main/src/index.scss"
    click MapStyle "https://github.com/dilli-k/geographic-path-finder/blob/main/public/map_style.json"
    click WebManifest "https://github.com/dilli-k/geographic-path-finder/blob/main/public/site.webmanifest"
    click BrowserCfg "https://github.com/dilli-k/geographic-path-finder/blob/main/public/browserconfig.xml"
    click Videos "https://github.com/dilli-k/geographic-path-finder/tree/main/public/videos/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#369,stroke-width:1px
    classDef service fill:#DFFFD0,stroke:#393,stroke-width:1px
    classDef domain fill:#FFE8C0,stroke:#D96,stroke-width:1px
    classDef algorithm fill:#FFD0D0,stroke:#D33,stroke-width:1px
    classDef utility fill:#F0F0F0,stroke:#666,stroke-width:1px
    classDef asset fill:#E8E8F0,stroke:#667,stroke-width:1px,stroke-dasharray: 4 2
```
