# surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation architecture

> Architecture diagram of the GitHub repository surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation
- Repository: https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation

## Overview

GraphTrace ingests technical-documentation Markdown into chunks, extracts and normalizes a provenance-bearing knowledge graph, and builds a shared vector index. For a question, its runtime entry point selects either baseline vector retrieval or GraphRAG retrieval, then generates a grounded answer with checked citations. The Streamlit interface exposes the system, while an evaluation subsystem compares retrieval methods on labeled questions. Offline and retrieval links follow the README; implementation links cite the sampled entry point or source-index references, so unsampled internals are not expanded into speculative call chains.

Main entry points: [`src/graphtrace/pipeline.py`](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/pipeline.py) (GraphTrace entry point), [`src/graphtrace/retrieval/graph_retriever.py`](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/graph_retriever.py) (Graph retrieval), [`src/graphtrace/evaluation/runner.py`](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/runner.py) (Evaluation runner), [`src/graphtrace/graph/builder.py`](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/builder.py) (Knowledge graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest_graph["Knowledge graph"]
  node_chunking["Document chunking<br/>[chunker.py]"]
  node_extraction["Entity extraction<br/>[extractor.py]"]
  node_validation["Extraction validation<br/>[validation.py]"]
  node_normalization["Entity normalization<br/>[normalizer.py]"]
  node_graph_store[("Knowledge graph<br/>[builder.py]")]
  node_integrity["Graph integrity<br/>[integrity.py]"]
end

subgraph group_retrieval_answer["Retrieval and answers"]
  node_embedding["Local embeddings<br/>[embedder.py]"]
  node_vector_store[("FAISS vector index<br/>[vector_index.py]")]
  node_pipeline["GraphTrace entry point<br/>[pipeline.py]"]
  node_baseline["Baseline retrieval<br/>[baseline.py]"]
  node_entity_linking["Entity linking<br/>[entity_linker.py]"]
  node_graph_retrieval["Graph retrieval<br/>[graph_retriever.py]"]
  node_traversal["Graph traversal<br/>[traversal.py]"]
  node_answerer["Grounded answerer<br/>[answerer.py]"]
  node_llm_client["Gemini client<br/>[llm_client.py]"]
end

subgraph group_interface["User interface"]
  node_streamlit["Streamlit interface<br/>[streamlit_app.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_eval_dataset["Evaluation questions<br/>[dataset.py]"]
  node_eval_runner["Evaluation runner<br/>[runner.py]"]
  node_judge["LLM judge<br/>[judge.py]"]
  node_metrics["Deterministic metrics<br/>[metrics.py]"]
  node_eval_report["Evaluation report<br/>[report.py]"]
end

node_docs["Markdown docs"]
node_questioner(("Questioner"))
node_llm{{"Gemini API"}}

node_docs -->|"chunks"| node_chunking
node_chunking -->|"supplies chunks"| node_extraction
node_extraction -->|"validates output"| node_validation
node_validation -->|"normalizes records"| node_normalization
node_normalization -->|"builds graph data"| node_graph_store
node_graph_store -->|"checks integrity"| node_integrity
node_chunking -->|"embeds chunks"| node_embedding
node_embedding -->|"builds index"| node_vector_store
node_questioner -->|"asks question"| node_pipeline
node_pipeline -->|"loads index"| node_vector_store
node_pipeline -->|"loads graph"| node_graph_store
node_pipeline -->|"dispatches baseline"| node_baseline
node_pipeline -->|"dispatches GraphRAG"| node_graph_retrieval
node_pipeline -->|"sends retrieval"| node_answerer
node_baseline -->|"embeds question"| node_embedding
node_baseline -->|"searches vectors"| node_vector_store
node_graph_retrieval -->|"embeds question"| node_embedding
node_graph_retrieval -->|"gets vector hits"| node_vector_store
node_graph_retrieval -->|"links entities"| node_entity_linking
node_graph_retrieval -->|"queries graph"| node_graph_store
node_graph_retrieval -->|"traverses graph"| node_traversal
node_answerer -->|"requests answer"| node_llm_client
node_llm_client -->|"calls Gemini"| node_llm
node_answerer -->|"checks citations"| node_pipeline
node_questioner -->|"uses interface"| node_streamlit
node_streamlit -->|"submits queries"| node_pipeline
node_eval_dataset -->|"provides questions"| node_eval_runner
node_eval_runner -->|"compares methods"| node_pipeline
node_eval_runner -->|"requests judgments"| node_judge
node_eval_runner -->|"computes metrics"| node_metrics
node_eval_runner -->|"reports results"| node_eval_report

click node_chunking "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/ingestion/chunker.py"
click node_extraction "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/extraction/extractor.py"
click node_validation "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/extraction/validation.py"
click node_normalization "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/extraction/normalizer.py"
click node_graph_store "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/builder.py"
click node_integrity "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/integrity.py"
click node_embedding "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/embedder.py"
click node_vector_store "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/vector_index.py"
click node_pipeline "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/pipeline.py"
click node_baseline "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/baseline.py"
click node_entity_linking "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/entity_linker.py"
click node_graph_retrieval "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/graph_retriever.py"
click node_traversal "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/traversal.py"
click node_answerer "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/generation/answerer.py"
click node_llm_client "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/generation/llm_client.py"
click node_streamlit "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/app/streamlit_app.py"
click node_eval_dataset "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/dataset.py"
click node_eval_runner "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/runner.py"
click node_judge "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/judge.py"
click node_metrics "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/metrics.py"
click node_eval_report "https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/report.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_chunking,node_extraction,node_validation,node_normalization,node_graph_store,node_integrity toneBlue
class node_embedding,node_vector_store,node_pipeline,node_baseline,node_entity_linking,node_graph_retrieval,node_traversal,node_answerer,node_llm_client toneAmber
class node_streamlit,node_llm toneMint
class node_eval_dataset,node_eval_runner,node_judge,node_metrics,node_eval_report toneRose
class node_docs,node_questioner toneIndigo
```

## Components

### Knowledge graph

- [Document chunking](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/ingestion/chunker.py): `src/graphtrace/ingestion/chunker.py`
- [Entity extraction](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/extraction/extractor.py): `src/graphtrace/extraction/extractor.py`
- [Extraction validation](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/extraction/validation.py): `src/graphtrace/extraction/validation.py`
- [Entity normalization](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/extraction/normalizer.py): `src/graphtrace/extraction/normalizer.py`
- [Knowledge graph](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/builder.py): `src/graphtrace/graph/builder.py`
- [Graph integrity](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/integrity.py): `src/graphtrace/graph/integrity.py`

### Retrieval and answers

- [Local embeddings](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/embedder.py): `src/graphtrace/retrieval/embedder.py`
- [FAISS vector index](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/vector_index.py): `src/graphtrace/retrieval/vector_index.py`
- [GraphTrace entry point](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/pipeline.py): `src/graphtrace/pipeline.py`
- [Baseline retrieval](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/baseline.py): `src/graphtrace/retrieval/baseline.py`
- [Entity linking](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/entity_linker.py): `src/graphtrace/retrieval/entity_linker.py`
- [Graph retrieval](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/retrieval/graph_retriever.py): `src/graphtrace/retrieval/graph_retriever.py`
- [Graph traversal](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/graph/traversal.py): `src/graphtrace/graph/traversal.py`
- [Grounded answerer](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/generation/answerer.py): `src/graphtrace/generation/answerer.py`
- [Gemini client](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/generation/llm_client.py): `src/graphtrace/generation/llm_client.py`

### User interface

- [Streamlit interface](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/app/streamlit_app.py): `app/streamlit_app.py`

### Evaluation

- [Evaluation questions](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/dataset.py): `src/graphtrace/evaluation/dataset.py`
- [Evaluation runner](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/runner.py): `src/graphtrace/evaluation/runner.py`
- [LLM judge](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/judge.py): `src/graphtrace/evaluation/judge.py`
- [Deterministic metrics](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/metrics.py): `src/graphtrace/evaluation/metrics.py`
- [Evaluation report](https://github.com/surajit-13-sutradhar/graphtrace-explainable-graphrag-with-retrieval-evaluation/blob/main/src/graphtrace/evaluation/report.py): `src/graphtrace/evaluation/report.py`

### Other components

- **Markdown docs**
- **Questioner**
- **Gemini API**

## Connections

- Markdown docs → Document chunking: chunks
- Document chunking → Entity extraction: supplies chunks
- Entity extraction → Extraction validation: validates output (evidence: `src/graphtrace/extraction/extractor.py`)
- Extraction validation → Entity normalization: normalizes records
- Entity normalization → Knowledge graph: builds graph data
- Knowledge graph → Graph integrity: checks integrity
- Document chunking → Local embeddings: embeds chunks
- Local embeddings → FAISS vector index: builds index (evidence: `src/graphtrace/retrieval/vector_index.py`)
- Questioner → GraphTrace entry point: asks question (evidence: `src/graphtrace/pipeline.py`)
- GraphTrace entry point → FAISS vector index: loads index (evidence: `src/graphtrace/pipeline.py`)
- GraphTrace entry point → Knowledge graph: loads graph (evidence: `src/graphtrace/pipeline.py`)
- GraphTrace entry point → Baseline retrieval: dispatches baseline (evidence: `src/graphtrace/pipeline.py`)
- GraphTrace entry point → Graph retrieval: dispatches GraphRAG (evidence: `src/graphtrace/pipeline.py`)
- GraphTrace entry point → Grounded answerer: sends retrieval (evidence: `src/graphtrace/pipeline.py`)
- Baseline retrieval → Local embeddings: embeds question (evidence: `src/graphtrace/retrieval/baseline.py`)
- Baseline retrieval → FAISS vector index: searches vectors (evidence: `src/graphtrace/retrieval/baseline.py`)
- Graph retrieval → Local embeddings: embeds question (evidence: `src/graphtrace/retrieval/graph_retriever.py`)
- Graph retrieval → FAISS vector index: gets vector hits (evidence: `src/graphtrace/retrieval/graph_retriever.py`)
- Graph retrieval → Entity linking: links entities (evidence: `src/graphtrace/retrieval/graph_retriever.py`)
- Graph retrieval → Knowledge graph: queries graph
- Graph retrieval → Graph traversal: traverses graph (evidence: `src/graphtrace/retrieval/graph_retriever.py`)
- Grounded answerer → Gemini client: requests answer (evidence: `src/graphtrace/generation/answerer.py`)
- Gemini client → Gemini API: calls Gemini (evidence: `src/graphtrace/generation/llm_client.py`)
- Grounded answerer → GraphTrace entry point: checks citations (evidence: `src/graphtrace/generation/answerer.py`)
- Questioner → Streamlit interface: uses interface (evidence: `app/streamlit_app.py`)
- Streamlit interface → GraphTrace entry point: submits queries (evidence: `app/streamlit_app.py`)
- Evaluation questions → Evaluation runner: provides questions (evidence: `src/graphtrace/evaluation/runner.py`)
- Evaluation runner → GraphTrace entry point: compares methods (evidence: `src/graphtrace/evaluation/runner.py`)
- Evaluation runner → LLM judge: requests judgments (evidence: `src/graphtrace/evaluation/runner.py`)
- Evaluation runner → Deterministic metrics: computes metrics (evidence: `src/graphtrace/evaluation/runner.py`)
- Evaluation runner → Evaluation report: reports results (evidence: `src/graphtrace/evaluation/report.py`)
