# lorenzosciandra/graphconvolutionalbranchandbound architecture

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

- Interactive diagram: https://gitdiagram.com/lorenzosciandra/graphconvolutionalbranchandbound
- Repository: https://github.com/lorenzosciandra/graphconvolutionalbranchandbound

## Overview

This repository implements a Traveling Salesman Problem solver combining Concorde’s exact branch-and-bound machinery with graph-neural-network guidance; it also contains a 1-tree solver and related GNN tooling. The principal workflow is to supply a TSP instance, use a learned optimality score to guide search, and return a tour. README statements support the high-level hybrid links; source-index references support only a subset of implementation links, so unverified runtime wiring is omitted.

Main entry points: [`src/HybridSolver/Concorde/src/TSP/tsp_lp.c`](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/TSP/tsp_lp.c) (Exact Search), [`src/HybridSolver/Concorde/models/unsupervised gnn training/inference.py`](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/unsupervised%20gnn%20training/inference.py) (Learned Scoring), [`src/HybridSolver/Concorde/runner.py`](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/runner.py) (Hybrid Runner), [`src/HybridSolver/1tree/main/main.c`](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/main.c) (1-tree Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hybrid["Hybrid Guidance"]
  node_hybrid_runner["Hybrid Runner<br/>[runner.py]"]
  node_gnn_score["Learned Scoring<br/>[inference.py]"]
end

subgraph group_learning["GNN Learning"]
  node_training_data["Training Dataset<br/>[dataset.py]"]
  node_trained_model["GNN Model<br/>[model.py]"]
  node_gcn_pipeline["GCN Pipeline<br/>[main.py]"]
  node_beam_search["Beam Search<br/>[beamsearch.py]"]
end

subgraph group_concorde["Concorde Solver"]
  node_concorde_search["Exact Search<br/>[tsp_lp.c]"]
  node_concorde_types["TSP Search Model<br/>[tsp.h]"]
  node_edge_generation["Candidate Edges<br/>[edgegen.c]"]
  node_local_search["Tour Improvement<br/>[linkern.c]"]
  node_cut_verification["Cut Verification<br/>[verify.c]"]
  node_tiny_solver["Tiny TSP Solver<br/>[tinytsp.c]"]
end

subgraph group_onetree["1-tree Solver"]
  node_one_tree_entry["1-tree Entry<br/>[main.c]"]
  node_one_tree_bnb["1-tree Branching<br/>[branch_and_bound.c]"]
  node_one_tree_reader["Instance Reader"]
  node_one_tree_graph["Graph Structures<br/>[graph.c]"]
end

node_user(("TSP User"))
node_instance["TSP Instance"]

node_user -->|"submits instance"| node_hybrid_runner
node_instance -->|"provides input"| node_hybrid_runner
node_hybrid_runner -->|"uses guidance"| node_gnn_score
node_hybrid_runner -->|"runs exact search"| node_concorde_search
node_gnn_score -->|"guides node ordering"| node_concorde_search
node_concorde_search -->|"returns tour"| node_user
node_gnn_score -->|"loads dataset"| node_training_data
node_gnn_score -->|"initializes model"| node_trained_model
node_gcn_pipeline -.->|"uses beam search"| node_beam_search
node_concorde_search -->|"uses search structures"| node_concorde_types
node_concorde_search -.->|"generates edges"| node_edge_generation
node_concorde_search -.->|"improves tours"| node_local_search
node_concorde_search -.->|"checks cuts"| node_cut_verification
node_one_tree_entry -.->|"reads instance"| node_one_tree_reader
node_one_tree_entry -.->|"starts branching"| node_one_tree_bnb
node_one_tree_bnb -.->|"uses graph data"| node_one_tree_graph

click node_hybrid_runner "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/runner.py"
click node_gnn_score "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/unsupervised%20gnn%20training/inference.py"
click node_concorde_search "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/TSP/tsp_lp.c"
click node_concorde_types "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/INCLUDE/tsp.h"
click node_edge_generation "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/EDGEGEN/edgegen.c"
click node_local_search "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/LINKERN/linkern.c"
click node_cut_verification "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/VERIFY/verify.c"
click node_tiny_solver "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/TINY/tinytsp.c"
click node_training_data "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/dataset.py"
click node_trained_model "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/model.py"
click node_gcn_pipeline "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/graph-convnet-tsp/main.py"
click node_beam_search "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/graph-convnet-tsp/utils/beamsearch.py"
click node_one_tree_entry "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/main.c"
click node_one_tree_bnb "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/algorithms/branch_and_bound.c"
click node_one_tree_reader "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/tsp_instance_reader.c"
click node_one_tree_graph "https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/data_structures/graph.c"

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_hybrid_runner,node_gnn_score,node_user toneBlue
class node_training_data,node_trained_model,node_gcn_pipeline,node_beam_search toneAmber
class node_concorde_search,node_concorde_types,node_edge_generation,node_local_search,node_cut_verification,node_tiny_solver toneMint
class node_one_tree_entry,node_one_tree_bnb,node_one_tree_reader,node_one_tree_graph toneRose
class node_instance toneIndigo
```

## Components

### Hybrid Guidance

- [Hybrid Runner](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/runner.py): `src/HybridSolver/Concorde/runner.py`
- [Learned Scoring](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/unsupervised%20gnn%20training/inference.py): `src/HybridSolver/Concorde/models/unsupervised gnn training/inference.py`

### GNN Learning

- [Training Dataset](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/dataset.py): `src/HybridSolver/Concorde/models/dataset.py`
- [GNN Model](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/models/model.py): `src/HybridSolver/Concorde/models/model.py`
- [GCN Pipeline](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/graph-convnet-tsp/main.py): `src/HybridSolver/1tree/main/graph-convnet-tsp/main.py`
- [Beam Search](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/graph-convnet-tsp/utils/beamsearch.py): `src/HybridSolver/1tree/main/graph-convnet-tsp/utils/beamsearch.py`

### Concorde Solver

- [Exact Search](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/TSP/tsp_lp.c): `src/HybridSolver/Concorde/src/TSP/tsp_lp.c`
- [TSP Search Model](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/INCLUDE/tsp.h): `src/HybridSolver/Concorde/src/INCLUDE/tsp.h`
- [Candidate Edges](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/EDGEGEN/edgegen.c): `src/HybridSolver/Concorde/src/EDGEGEN/edgegen.c`
- [Tour Improvement](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/LINKERN/linkern.c): `src/HybridSolver/Concorde/src/LINKERN/linkern.c`
- [Cut Verification](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/VERIFY/verify.c): `src/HybridSolver/Concorde/src/VERIFY/verify.c`
- [Tiny TSP Solver](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/Concorde/src/TINY/tinytsp.c): `src/HybridSolver/Concorde/src/TINY/tinytsp.c`

### 1-tree Solver

- [1-tree Entry](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/main.c): `src/HybridSolver/1tree/main/main.c`
- [1-tree Branching](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/algorithms/branch_and_bound.c): `src/HybridSolver/1tree/main/algorithms/branch_and_bound.c`
- [Instance Reader](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/tsp_instance_reader.c): `src/HybridSolver/1tree/main/tsp_instance_reader.c`
- [Graph Structures](https://github.com/lorenzosciandra/graphconvolutionalbranchandbound/blob/main/src/HybridSolver/1tree/main/data_structures/graph.c): `src/HybridSolver/1tree/main/data_structures/graph.c`

### Other components

- **TSP User**
- **TSP Instance**

## Connections

- TSP User → Hybrid Runner: submits instance
- TSP Instance → Hybrid Runner: provides input
- Hybrid Runner → Learned Scoring: uses guidance
- Hybrid Runner → Exact Search: runs exact search
- Learned Scoring → Exact Search: guides node ordering
- Exact Search → TSP User: returns tour
- Learned Scoring → Training Dataset: loads dataset (evidence: `src/HybridSolver/Concorde/models/unsupervised gnn training/inference.py`)
- Learned Scoring → GNN Model: initializes model (evidence: `src/HybridSolver/Concorde/models/unsupervised gnn training/inference.py`)
- GCN Pipeline → Beam Search: uses beam search
- Exact Search → TSP Search Model: uses search structures (evidence: `src/HybridSolver/Concorde/src/TSP/tsp_lp.c`)
- Exact Search → Candidate Edges: generates edges
- Exact Search → Tour Improvement: improves tours
- Exact Search → Cut Verification: checks cuts
- 1-tree Entry → Instance Reader: reads instance
- 1-tree Entry → 1-tree Branching: starts branching
- 1-tree Branching → Graph Structures: uses graph data
