# mashingan/graflib architecture

> Architecture diagram of the GitHub repository mashingan/graflib, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mashingan/graflib
- Repository: https://github.com/mashingan/graflib

## Overview

##### Algorithm Flow

- Input Graph Data → Graph Construction
- Graph → Path Finding Algorithms
- A* Search Requirements → Cost/Distance Functions
- Results → Client Code

##### Integration Points

External integration points:
- Test Framework Connection
- Documentation Generation

##### Specific Implementation Details

- Generic Type Constraints
- Required Function Signatures:
- cost[N, C](n1, n2: N): C
- distance[N, C](n1, n2: N): C

##### Use Cases Section

A panel showing supported example applications:
- Knapsack Problem
- Water Jugs Problem
- Sliding Puzzle
- Project Scheduling
- Send More Money Puzzle

- Double lines: Data flow

##### Documentation generation flow

Level of Detail:

- A* implementation details
- Generic type system
- Example integration patterns

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        GC[Graflib Core]:::core
        GC --> GCon[Graph Construction]:::core
        GC --> UGC[Undirected Graph Conversion]:::core
        GC --> NF[Neighbor Finding]:::core
        GC --> PF[Path Finding - DFS]:::core
        GC --> AS[A* Search Algorithm]:::core
    end

    subgraph Interface
        TI[Type Interface]:::interface
        NT[Node Type N]:::interface
        CT[Cost Type C]:::interface
        TI --> NT
        TI --> CT
    end

    subgraph Requirements
        RC[Required Operations]:::req
        CF["cost[N,C](n1,n2: N): C"]:::req
        DF["distance[N,C](n1,n2: N): C"]:::req
        RC --> CF
        RC --> DF
    end

    subgraph "Example Applications"
        KP[Knapsack Problem]:::example
        WJ[Water Jugs Problem]:::example
        SP[Sliding Puzzle]:::example
        PS[Project Scheduling]:::example
        SM[Send More Money]:::example
    end

    subgraph Testing
        TF[Test Framework]:::test
        AST[A* Search Tests]:::test
        PFT[Path Finding Tests]:::test
    end

    subgraph Integration
        CI[CI/CD Pipeline]:::integration
        PC[Package Config]:::integration
        EC[Example Config]:::integration
        TC[Test Config]:::integration
    end

    GC --> TI
    TI --> RC
    RC --> AS
    GC --> KP
    GC --> WJ
    GC --> SP
    GC --> PS
    GC --> SM
    GC --> TF
    TF --> AST
    TF --> PFT
    CI --> TF

    %% Click Events
    click GC "https://github.com/mashingan/graflib/blob/master/graflib.nim"
    click AST "https://github.com/mashingan/graflib/blob/master/tests/test_astar.nim"
    click PFT "https://github.com/mashingan/graflib/blob/master/tests/test_paths.nim"
    click CI "https://github.com/mashingan/graflib/blob/master/.github/workflows/main.yml"
    click KP "https://github.com/mashingan/graflib/blob/master/examples/knapsack.nim"
    click WJ "https://github.com/mashingan/graflib/blob/master/examples/waterjugs.nim"
    click SP "https://github.com/mashingan/graflib/blob/master/examples/sliding_puzzle.nim"
    click PS "https://github.com/mashingan/graflib/blob/master/examples/project_schedule.nim"
    click SM "https://github.com/mashingan/graflib/blob/master/examples/send_more_money.nim"
    click PC "https://github.com/mashingan/graflib/blob/master/graflib.nimble"
    click EC "https://github.com/mashingan/graflib/blob/master/examples/config.nims"
    click TC "https://github.com/mashingan/graflib/blob/master/tests/config.nims"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef interface fill:#2ecc71,stroke:#27ae60,color:white
    classDef req fill:#f1c40f,stroke:#f39c12,color:black
    classDef example fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef test fill:#e74c3c,stroke:#c0392b,color:white
    classDef integration fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Interfaces]:::interface
        L3[Requirements]:::req
        L4[Examples]:::example
        L5[Testing]:::test
        L6[Integration]:::integration
    end
```
