# bit34/bit34-graph architecture

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

- Interactive diagram: https://gitdiagram.com/bit34/bit34-graph
- Repository: https://github.com/bit34/bit34-graph

## Overview

Bit34 Graph Library is a minimal in-process graph API for constructing and traversing graphs, including regular grids and rectangular or hexagonal layouts. A client defines concrete graph/node/edge types and an agent, creates or populates the graph, then calls a PathFinder to search accessible edges and receive a full or permitted partial Path. The excerpts show graph mutation, layout construction, and path-search behavior; agent ownership and edge/path value types are included from the source index. No external services or persistence are indicated.

Main entry points: [`src/Com/Bit34Games/Graphs/Graph.cs`](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Graph.cs) (Graph), [`src/Com/Bit34Games/Graphs/RectGraph.cs`](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectGraph.cs) (Rectangular Grid), [`src/Com/Bit34Games/Graphs/HexGraph.cs`](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexGraph.cs) (Hexagonal Grid), [`src/Com/Bit34Games/Graphs/PathFinderProcess.cs`](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathFinderProcess.cs) (Search Process)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Graph Core"]
  node_graph["Graph<br/>[Graph.cs]"]
  node_node["Node<br/>[Node.cs]"]
  node_edge["Edge<br/>[Edge.cs]"]
  node_agent["Agent<br/>[Agent.cs]"]
  node_owners["Owner Interfaces<br/>[IAgentOwner.cs]"]
  node_nodeowner["Node Owner<br/>[INodeOwner.cs]"]
  node_pathowner["Path Owner<br/>[IPathOwner.cs]"]
  node_nodegroup["Node Groups<br/>[NodeGroup.cs]"]
end

subgraph group_grid["Grid Graphs"]
  node_gridgraph["Grid Graph<br/>[GridGraph.cs]"]
  node_gridnode["Grid Node<br/>[GridNode.cs]"]
  node_gridedge["Grid Edge<br/>[GridEdge.cs]"]
  node_rectgraph["Rectangular Grid<br/>[RectGraph.cs]"]
  node_rectnode["Rect Node<br/>[RectNode.cs]"]
  node_rectedge["Rect Edge<br/>[RectEdge.cs]"]
  node_rectdirs["Rect Directions"]
  node_hexgraph["Hexagonal Grid<br/>[HexGraph.cs]"]
  node_hexnode["Hex Node<br/>[HexNode.cs]"]
  node_hexedge["Hex Edge<br/>[HexEdge.cs]"]
  node_hexdirections["Hex Directions"]
end

subgraph group_search["Path Search"]
  node_pathfinder["Path Finder<br/>[PathFinder.cs]"]
  node_process["Search Process"]
  node_pathnode["Search Node<br/>[PathNode.cs]"]
  node_path["Path Result<br/>[Path.cs]"]
  node_pathtypes["Path Types<br/>[PathTypes.cs]"]
end

node_client(("Library Client"))

node_client -.->|"creates graph"| node_graph
node_client -.->|"requests search"| node_pathfinder
node_graph -->|"allocates nodes"| node_node
node_graph -->|"allocates edges"| node_edge
node_graph -->|"registers agents"| node_agent
node_graph -->|"implements ownership"| node_owners
node_node -->|"stores connections"| node_edge
node_agent -->|"implements ownership"| node_pathowner
node_gridgraph -->|"extends"| node_graph
node_gridnode -->|"extends"| node_node
node_gridedge -->|"extends"| node_edge
node_rectgraph -->|"extends"| node_gridgraph
node_rectgraph -->|"creates nodes"| node_rectnode
node_rectgraph -->|"creates edges"| node_rectedge
node_rectgraph -->|"uses directions"| node_rectdirs
node_hexgraph -->|"extends"| node_gridgraph
node_hexgraph -->|"creates nodes"| node_hexnode
node_hexgraph -->|"creates edges"| node_hexedge
node_hexgraph -->|"uses directions"| node_hexdirections
node_pathfinder -->|"runs search"| node_process
node_process -->|"tracks candidates"| node_pathnode
node_process -->|"reads graph owner"| node_agent
node_process -->|"checks accessibility"| node_pathfinder
node_pathfinder -->|"returns result"| node_path
node_path -->|"uses classification"| node_pathtypes

click node_graph "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Graph.cs"
click node_node "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Node.cs"
click node_edge "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Edge.cs"
click node_agent "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Agent.cs"
click node_owners "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/IAgentOwner.cs"
click node_nodeowner "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/INodeOwner.cs"
click node_pathowner "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/IPathOwner.cs"
click node_nodegroup "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/NodeGroup.cs"
click node_gridgraph "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/GridGraph.cs"
click node_gridnode "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/GridNode.cs"
click node_gridedge "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/GridEdge.cs"
click node_rectgraph "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectGraph.cs"
click node_rectnode "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectNode.cs"
click node_rectedge "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectEdge.cs"
click node_rectdirs "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectEdgeDirections.cs"
click node_hexgraph "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexGraph.cs"
click node_hexnode "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexNode.cs"
click node_hexedge "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexEdge.cs"
click node_hexdirections "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexEdgeDirections.cs"
click node_pathfinder "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathFinder.cs"
click node_process "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathFinderProcess.cs"
click node_pathnode "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathNode.cs"
click node_path "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Path.cs"
click node_pathtypes "https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathTypes.cs"

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_graph,node_node,node_edge,node_agent,node_owners,node_nodeowner,node_pathowner,node_nodegroup,node_client toneBlue
class node_gridgraph,node_gridnode,node_gridedge,node_rectgraph,node_rectnode,node_rectedge,node_rectdirs,node_hexgraph,node_hexnode,node_hexedge,node_hexdirections toneAmber
class node_pathfinder,node_process,node_pathnode,node_path,node_pathtypes toneMint
```

## Components

### Graph Core

- [Graph](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Graph.cs): `src/Com/Bit34Games/Graphs/Graph.cs`
- [Node](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Node.cs): `src/Com/Bit34Games/Graphs/Node.cs`
- [Edge](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Edge.cs): `src/Com/Bit34Games/Graphs/Edge.cs`
- [Agent](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Agent.cs): `src/Com/Bit34Games/Graphs/Agent.cs`
- [Owner Interfaces](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/IAgentOwner.cs): `src/Com/Bit34Games/Graphs/IAgentOwner.cs`
- [Node Owner](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/INodeOwner.cs): `src/Com/Bit34Games/Graphs/INodeOwner.cs`
- [Path Owner](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/IPathOwner.cs): `src/Com/Bit34Games/Graphs/IPathOwner.cs`
- [Node Groups](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/NodeGroup.cs): `src/Com/Bit34Games/Graphs/NodeGroup.cs`

### Grid Graphs

- [Grid Graph](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/GridGraph.cs): `src/Com/Bit34Games/Graphs/GridGraph.cs`
- [Grid Node](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/GridNode.cs): `src/Com/Bit34Games/Graphs/GridNode.cs`
- [Grid Edge](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/GridEdge.cs): `src/Com/Bit34Games/Graphs/GridEdge.cs`
- [Rectangular Grid](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectGraph.cs): `src/Com/Bit34Games/Graphs/RectGraph.cs`
- [Rect Node](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectNode.cs): `src/Com/Bit34Games/Graphs/RectNode.cs`
- [Rect Edge](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectEdge.cs): `src/Com/Bit34Games/Graphs/RectEdge.cs`
- [Rect Directions](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/RectEdgeDirections.cs): `src/Com/Bit34Games/Graphs/RectEdgeDirections.cs`
- [Hexagonal Grid](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexGraph.cs): `src/Com/Bit34Games/Graphs/HexGraph.cs`
- [Hex Node](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexNode.cs): `src/Com/Bit34Games/Graphs/HexNode.cs`
- [Hex Edge](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexEdge.cs): `src/Com/Bit34Games/Graphs/HexEdge.cs`
- [Hex Directions](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/HexEdgeDirections.cs): `src/Com/Bit34Games/Graphs/HexEdgeDirections.cs`

### Path Search

- [Path Finder](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathFinder.cs): `src/Com/Bit34Games/Graphs/PathFinder.cs`
- [Search Process](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathFinderProcess.cs): `src/Com/Bit34Games/Graphs/PathFinderProcess.cs`
- [Search Node](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathNode.cs): `src/Com/Bit34Games/Graphs/PathNode.cs`
- [Path Result](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/Path.cs): `src/Com/Bit34Games/Graphs/Path.cs`
- [Path Types](https://github.com/bit34/bit34-graph/blob/master/src/Com/Bit34Games/Graphs/PathTypes.cs): `src/Com/Bit34Games/Graphs/PathTypes.cs`

### Other components

- **Library Client**

## Connections

- Library Client → Graph: creates graph
- Library Client → Path Finder: requests search
- Graph → Node: allocates nodes (evidence: `src/Com/Bit34Games/Graphs/Graph.cs`)
- Graph → Edge: allocates edges (evidence: `src/Com/Bit34Games/Graphs/Graph.cs`)
- Graph → Agent: registers agents (evidence: `src/Com/Bit34Games/Graphs/Graph.cs`)
- Graph → Owner Interfaces: implements ownership (evidence: `src/Com/Bit34Games/Graphs/Graph.cs`)
- Node → Edge: stores connections (evidence: `src/Com/Bit34Games/Graphs/Node.cs`)
- Agent → Path Owner: implements ownership (evidence: `src/Com/Bit34Games/Graphs/Agent.cs`)
- Grid Graph → Graph: extends (evidence: `src/Com/Bit34Games/Graphs/GridGraph.cs`)
- Grid Node → Node: extends (evidence: `src/Com/Bit34Games/Graphs/GridNode.cs`)
- Grid Edge → Edge: extends (evidence: `src/Com/Bit34Games/Graphs/GridEdge.cs`)
- Rectangular Grid → Grid Graph: extends (evidence: `src/Com/Bit34Games/Graphs/RectGraph.cs`)
- Rectangular Grid → Rect Node: creates nodes (evidence: `src/Com/Bit34Games/Graphs/RectGraph.cs`)
- Rectangular Grid → Rect Edge: creates edges (evidence: `src/Com/Bit34Games/Graphs/RectGraph.cs`)
- Rectangular Grid → Rect Directions: uses directions (evidence: `src/Com/Bit34Games/Graphs/RectGraph.cs`)
- Hexagonal Grid → Grid Graph: extends (evidence: `src/Com/Bit34Games/Graphs/HexGraph.cs`)
- Hexagonal Grid → Hex Node: creates nodes (evidence: `src/Com/Bit34Games/Graphs/HexGraph.cs`)
- Hexagonal Grid → Hex Edge: creates edges (evidence: `src/Com/Bit34Games/Graphs/HexGraph.cs`)
- Hexagonal Grid → Hex Directions: uses directions (evidence: `src/Com/Bit34Games/Graphs/HexGraph.cs`)
- Path Finder → Search Process: runs search (evidence: `src/Com/Bit34Games/Graphs/PathFinder.cs`)
- Search Process → Search Node: tracks candidates (evidence: `src/Com/Bit34Games/Graphs/PathFinderProcess.cs`)
- Search Process → Agent: reads graph owner (evidence: `src/Com/Bit34Games/Graphs/PathFinderProcess.cs`)
- Search Process → Path Finder: checks accessibility (evidence: `src/Com/Bit34Games/Graphs/PathFinderProcess.cs`)
- Path Finder → Path Result: returns result (evidence: `src/Com/Bit34Games/Graphs/PathFinder.cs`)
- Path Result → Path Types: uses classification (evidence: `src/Com/Bit34Games/Graphs/Path.cs`)
