# bdqnghi/graph-ast architecture

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

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

## Overview

This repository is an fAST example bundle, not the parser or graph-generation implementation: the README documents the product workflow, while the tree contains sample inputs, generated artifacts, type tables, and a small pickle-loading example. The principal documented path is source code to serialized AST to graph output. Edges for the documented CLI workflow cite the README; the graph-generation internals cannot be verified from the available source.

Main entry points: [`sample_files/Java/Bubblesort.txt`](https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.txt) (AST graph), [`sample_files/Java/Bubblesort.fbs`](https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.fbs) (Flatbuffer AST), [`sample_files`](https://github.com/bdqnghi/graph-ast/tree/master/sample_files) (Source examples), [`traverse_tree_sample.py`](https://github.com/bdqnghi/graph-ast/blob/master/traverse_tree_sample.py) (Pickle loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_examples["Language examples"]
  node_source_examples["Source examples"]
end

subgraph group_serialization["AST artifacts"]
  node_protobuf_output["Protobuf AST<br/>[Bubblesort.pb]"]
  node_flatbuffer_output["Flatbuffer AST<br/>[Bubblesort.fbs]"]
  node_pickle_input["Pickled AST<br/>[Bubblesort.pkl]"]
end

subgraph group_graphing["Graph outputs"]
  node_graph_output["AST graph<br/>[Bubblesort.txt]"]
  node_node_types["Node types"]
  node_edge_types["Edge types<br/>[edge_types.tsv]"]
end

subgraph group_utilities["Sample utility"]
  node_pickle_reader["Pickle loader"]
end

node_developer(("Tool user"))
node_fast_tool["fAST CLI"]
node_graph_generator["Graph generator"]

node_developer -->|"runs CLI"| node_fast_tool
node_source_examples -->|"parses source"| node_fast_tool
node_fast_tool -->|"writes AST"| node_protobuf_output
node_fast_tool -->|"writes AST"| node_flatbuffer_output
node_flatbuffer_output -->|"feeds input"| node_graph_generator
node_graph_generator -->|"writes graph"| node_graph_output
node_graph_output -->|"uses type table"| node_node_types
node_graph_output -->|"uses type table"| node_edge_types
node_pickle_reader -->|"loads pickle"| node_pickle_input

click node_source_examples "https://github.com/bdqnghi/graph-ast/tree/master/sample_files"
click node_protobuf_output "https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.pb"
click node_flatbuffer_output "https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.fbs"
click node_graph_output "https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.txt"
click node_node_types "https://github.com/bdqnghi/graph-ast/blob/master/types/srcml_node_types.tsv"
click node_edge_types "https://github.com/bdqnghi/graph-ast/blob/master/types/edge_types.tsv"
click node_pickle_input "https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.pkl"
click node_pickle_reader "https://github.com/bdqnghi/graph-ast/blob/master/traverse_tree_sample.py"

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_source_examples,node_developer toneBlue
class node_protobuf_output,node_flatbuffer_output,node_pickle_input toneAmber
class node_graph_output,node_node_types,node_edge_types toneMint
class node_pickle_reader toneRose
class node_fast_tool,node_graph_generator toneIndigo
```

## Components

### Language examples

- [Source examples](https://github.com/bdqnghi/graph-ast/tree/master/sample_files): `sample_files`

### AST artifacts

- [Protobuf AST](https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.pb): `sample_files/Java/Bubblesort.pb`
- [Flatbuffer AST](https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.fbs): `sample_files/Java/Bubblesort.fbs`
- [Pickled AST](https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.pkl): `sample_files/Java/Bubblesort.pkl`

### Graph outputs

- [AST graph](https://github.com/bdqnghi/graph-ast/blob/master/sample_files/Java/Bubblesort.txt): `sample_files/Java/Bubblesort.txt`
- [Node types](https://github.com/bdqnghi/graph-ast/blob/master/types/srcml_node_types.tsv): `types/srcml_node_types.tsv`
- [Edge types](https://github.com/bdqnghi/graph-ast/blob/master/types/edge_types.tsv): `types/edge_types.tsv`

### Sample utility

- [Pickle loader](https://github.com/bdqnghi/graph-ast/blob/master/traverse_tree_sample.py): `traverse_tree_sample.py`

### Other components

- **Tool user**
- **fAST CLI**
- **Graph generator**

## Connections

- Tool user → fAST CLI: runs CLI (evidence: `README.md`)
- Source examples → fAST CLI: parses source (evidence: `README.md`)
- fAST CLI → Protobuf AST: writes AST (evidence: `README.md`)
- fAST CLI → Flatbuffer AST: writes AST (evidence: `README.md`)
- Flatbuffer AST → Graph generator: feeds input (evidence: `README.md`)
- Graph generator → AST graph: writes graph (evidence: `README.md`)
- AST graph → Node types: uses type table (evidence: `README.md`)
- AST graph → Edge types: uses type table (evidence: `README.md`)
- Pickle loader → Pickled AST: loads pickle (evidence: `traverse_tree_sample.py`)
