# sbeamer/gapbs architecture

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

- Interactive diagram: https://gitdiagram.com/sbeamer/gapbs
- Repository: https://github.com/sbeamer/gapbs

## Overview

GAP Benchmark Suite is a portable, OpenMP-capable reference implementation for evaluating graph-processing kernels. A user selects a kernel executable and supplies a graph file or synthetic-graph options; the kernel parses options, builds a graph, runs its algorithm, and can verify and report results. The README documents six kernel families and multiple graph formats. The graph-building path is supported by the source index and excerpts; details of unsampled kernels and benchmark reporting are represented only where documented or referenced.

Main entry points: [`src/builder.h`](https://github.com/sbeamer/gapbs/blob/master/src/builder.h) (Graph builder), [`src/bfs.cc`](https://github.com/sbeamer/gapbs/blob/master/src/bfs.cc) (Direction-optimizing BFS), [`src/benchmark.h`](https://github.com/sbeamer/gapbs/blob/master/src/benchmark.h) (Benchmark harness), [`src/graph.h`](https://github.com/sbeamer/gapbs/blob/master/src/graph.h) (CSR graph)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Inputs and execution"]
  node_cli["CLI options<br/>[command_line.h]"]
  node_harness["Benchmark harness<br/>[benchmark.h]"]
end

subgraph group_build["Graph construction"]
  node_reader["Graph file reader<br/>[reader.h]"]
  node_generator["Synthetic generator<br/>[generator.h]"]
  node_builder["Graph builder<br/>[builder.h]"]
  node_graph["CSR graph<br/>[graph.h]"]
  node_converter["Graph converter<br/>[converter.cc]"]
  node_writer["Serialized graph writer<br/>[writer.h]"]
end

subgraph group_kernels["Graph kernels"]
  node_bfs["Direction-optimizing BFS<br/>[bfs.cc]"]
  node_sssp["Delta-stepping SSSP<br/>[sssp.cc]"]
  node_pagerank["PageRank variants<br/>[pr.cc]"]
  node_pagerank_spmv["PageRank SpMV<br/>[pr_spmv.cc]"]
  node_components["Afforest components<br/>[cc.cc]"]
  node_components_sv["Shiloach-Vishkin components<br/>[cc_sv.cc]"]
  node_bc["Brandes centrality<br/>[bc.cc]"]
  node_tc["Triangle counting<br/>[tc.cc]"]
end

subgraph group_support["Runtime support"]
  node_parallel["Parallel containers<br/>[pvector.h]"]
  node_bitmap["Parallel bitmap<br/>[bitmap.h]"]
  node_queue["Sliding queue<br/>[sliding_queue.h]"]
  node_atomics["Atomic operations<br/>[platform_atomics.h]"]
  node_timing["Timing utilities<br/>[timer.h]"]
end

node_user(("Benchmark user"))

node_user -->|"sets options"| node_cli
node_cli -->|"configures build"| node_builder
node_builder -->|"reads file input"| node_reader
node_builder -->|"generates input"| node_generator
node_builder -->|"constructs graph"| node_graph
node_converter -->|"loads graph"| node_builder
node_converter -->|"writes graph"| node_writer
node_bfs -->|"parses options"| node_cli
node_bfs -->|"builds graph"| node_builder
node_bfs -->|"traverses graph"| node_graph
node_bfs -.->|"runs benchmark"| node_harness
node_sssp -->|"parses options"| node_cli
node_sssp -->|"builds graph"| node_builder
node_sssp -->|"relaxes edges"| node_graph
node_sssp -->|"runs benchmark"| node_harness
node_pagerank -->|"builds graph"| node_builder
node_pagerank -->|"runs benchmark"| node_harness
node_pagerank_spmv -->|"builds graph"| node_builder
node_pagerank_spmv -->|"runs benchmark"| node_harness
node_components -->|"builds graph"| node_builder
node_components -->|"runs benchmark"| node_harness
node_components_sv -->|"builds graph"| node_builder
node_components_sv -->|"runs benchmark"| node_harness
node_bc -->|"builds graph"| node_builder
node_bc -->|"traverses graph"| node_graph
node_tc -->|"builds graph"| node_builder
node_parallel -->|"backs graph data"| node_graph
node_bitmap -->|"uses atomics"| node_atomics
node_queue -->|"uses atomics"| node_atomics
node_builder -->|"stores build data"| node_parallel
node_builder -->|"times build"| node_timing
node_bfs -->|"uses frontier bitmap"| node_bitmap
node_bfs -->|"uses frontier queue"| node_queue
node_bc -->|"tracks successors"| node_bitmap
node_bc -->|"uses traversal queue"| node_queue

click node_cli "https://github.com/sbeamer/gapbs/blob/master/src/command_line.h"
click node_harness "https://github.com/sbeamer/gapbs/blob/master/src/benchmark.h"
click node_reader "https://github.com/sbeamer/gapbs/blob/master/src/reader.h"
click node_generator "https://github.com/sbeamer/gapbs/blob/master/src/generator.h"
click node_builder "https://github.com/sbeamer/gapbs/blob/master/src/builder.h"
click node_graph "https://github.com/sbeamer/gapbs/blob/master/src/graph.h"
click node_converter "https://github.com/sbeamer/gapbs/blob/master/src/converter.cc"
click node_writer "https://github.com/sbeamer/gapbs/blob/master/src/writer.h"
click node_bfs "https://github.com/sbeamer/gapbs/blob/master/src/bfs.cc"
click node_sssp "https://github.com/sbeamer/gapbs/blob/master/src/sssp.cc"
click node_pagerank "https://github.com/sbeamer/gapbs/blob/master/src/pr.cc"
click node_pagerank_spmv "https://github.com/sbeamer/gapbs/blob/master/src/pr_spmv.cc"
click node_components "https://github.com/sbeamer/gapbs/blob/master/src/cc.cc"
click node_components_sv "https://github.com/sbeamer/gapbs/blob/master/src/cc_sv.cc"
click node_bc "https://github.com/sbeamer/gapbs/blob/master/src/bc.cc"
click node_tc "https://github.com/sbeamer/gapbs/blob/master/src/tc.cc"
click node_parallel "https://github.com/sbeamer/gapbs/blob/master/src/pvector.h"
click node_bitmap "https://github.com/sbeamer/gapbs/blob/master/src/bitmap.h"
click node_queue "https://github.com/sbeamer/gapbs/blob/master/src/sliding_queue.h"
click node_atomics "https://github.com/sbeamer/gapbs/blob/master/src/platform_atomics.h"
click node_timing "https://github.com/sbeamer/gapbs/blob/master/src/timer.h"

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_cli,node_harness,node_user toneBlue
class node_reader,node_generator,node_builder,node_graph,node_converter,node_writer toneAmber
class node_bfs,node_sssp,node_pagerank,node_pagerank_spmv,node_components,node_components_sv,node_bc,node_tc toneMint
class node_parallel,node_bitmap,node_queue,node_atomics,node_timing toneRose
```

## Components

### Inputs and execution

- [CLI options](https://github.com/sbeamer/gapbs/blob/master/src/command_line.h): `src/command_line.h`
- [Benchmark harness](https://github.com/sbeamer/gapbs/blob/master/src/benchmark.h): `src/benchmark.h`

### Graph construction

- [Graph file reader](https://github.com/sbeamer/gapbs/blob/master/src/reader.h): `src/reader.h`
- [Synthetic generator](https://github.com/sbeamer/gapbs/blob/master/src/generator.h): `src/generator.h`
- [Graph builder](https://github.com/sbeamer/gapbs/blob/master/src/builder.h): `src/builder.h`
- [CSR graph](https://github.com/sbeamer/gapbs/blob/master/src/graph.h): `src/graph.h`
- [Graph converter](https://github.com/sbeamer/gapbs/blob/master/src/converter.cc): `src/converter.cc`
- [Serialized graph writer](https://github.com/sbeamer/gapbs/blob/master/src/writer.h): `src/writer.h`

### Graph kernels

- [Direction-optimizing BFS](https://github.com/sbeamer/gapbs/blob/master/src/bfs.cc): `src/bfs.cc`
- [Delta-stepping SSSP](https://github.com/sbeamer/gapbs/blob/master/src/sssp.cc): `src/sssp.cc`
- [PageRank variants](https://github.com/sbeamer/gapbs/blob/master/src/pr.cc): `src/pr.cc`
- [PageRank SpMV](https://github.com/sbeamer/gapbs/blob/master/src/pr_spmv.cc): `src/pr_spmv.cc`
- [Afforest components](https://github.com/sbeamer/gapbs/blob/master/src/cc.cc): `src/cc.cc`
- [Shiloach-Vishkin components](https://github.com/sbeamer/gapbs/blob/master/src/cc_sv.cc): `src/cc_sv.cc`
- [Brandes centrality](https://github.com/sbeamer/gapbs/blob/master/src/bc.cc): `src/bc.cc`
- [Triangle counting](https://github.com/sbeamer/gapbs/blob/master/src/tc.cc): `src/tc.cc`

### Runtime support

- [Parallel containers](https://github.com/sbeamer/gapbs/blob/master/src/pvector.h): `src/pvector.h`
- [Parallel bitmap](https://github.com/sbeamer/gapbs/blob/master/src/bitmap.h): `src/bitmap.h`
- [Sliding queue](https://github.com/sbeamer/gapbs/blob/master/src/sliding_queue.h): `src/sliding_queue.h`
- [Atomic operations](https://github.com/sbeamer/gapbs/blob/master/src/platform_atomics.h): `src/platform_atomics.h`
- [Timing utilities](https://github.com/sbeamer/gapbs/blob/master/src/timer.h): `src/timer.h`

### Other components

- **Benchmark user**

## Connections

- Benchmark user → CLI options: sets options (evidence: `README.md`)
- CLI options → Graph builder: configures build (evidence: `src/builder.h`)
- Graph builder → Graph file reader: reads file input (evidence: `src/builder.h`)
- Graph builder → Synthetic generator: generates input (evidence: `src/builder.h`)
- Graph builder → CSR graph: constructs graph (evidence: `src/builder.h`)
- Graph converter → Graph builder: loads graph (evidence: `src/converter.cc`)
- Graph converter → Serialized graph writer: writes graph (evidence: `src/converter.cc`)
- Direction-optimizing BFS → CLI options: parses options (evidence: `src/bfs.cc`)
- Direction-optimizing BFS → Graph builder: builds graph (evidence: `src/bfs.cc`)
- Direction-optimizing BFS → CSR graph: traverses graph (evidence: `src/bfs.cc`)
- Direction-optimizing BFS → Benchmark harness: runs benchmark (evidence: `src/bfs.cc`)
- Delta-stepping SSSP → CLI options: parses options (evidence: `src/sssp.cc`)
- Delta-stepping SSSP → Graph builder: builds graph (evidence: `src/sssp.cc`)
- Delta-stepping SSSP → CSR graph: relaxes edges (evidence: `src/sssp.cc`)
- Delta-stepping SSSP → Benchmark harness: runs benchmark (evidence: `src/sssp.cc`)
- PageRank variants → Graph builder: builds graph (evidence: `src/pr.cc`)
- PageRank variants → Benchmark harness: runs benchmark (evidence: `src/pr.cc`)
- PageRank SpMV → Graph builder: builds graph (evidence: `src/pr_spmv.cc`)
- PageRank SpMV → Benchmark harness: runs benchmark (evidence: `src/pr_spmv.cc`)
- Afforest components → Graph builder: builds graph (evidence: `src/cc.cc`)
- Afforest components → Benchmark harness: runs benchmark (evidence: `src/cc.cc`)
- Shiloach-Vishkin components → Graph builder: builds graph (evidence: `src/cc_sv.cc`)
- Shiloach-Vishkin components → Benchmark harness: runs benchmark (evidence: `src/cc_sv.cc`)
- Brandes centrality → Graph builder: builds graph (evidence: `src/bc.cc`)
- Brandes centrality → CSR graph: traverses graph (evidence: `src/bc.cc`)
- Triangle counting → Graph builder: builds graph (evidence: `src/tc.cc`)
- Parallel containers → CSR graph: backs graph data (evidence: `src/graph.h`)
- Parallel bitmap → Atomic operations: uses atomics (evidence: `src/bitmap.h`)
- Sliding queue → Atomic operations: uses atomics (evidence: `src/sliding_queue.h`)
- Graph builder → Parallel containers: stores build data (evidence: `src/builder.h`)
- Graph builder → Timing utilities: times build (evidence: `src/builder.h`)
- Direction-optimizing BFS → Parallel bitmap: uses frontier bitmap (evidence: `src/bfs.cc`)
- Direction-optimizing BFS → Sliding queue: uses frontier queue (evidence: `src/bfs.cc`)
- Brandes centrality → Parallel bitmap: tracks successors (evidence: `src/bc.cc`)
- Brandes centrality → Sliding queue: uses traversal queue (evidence: `src/bc.cc`)
