# thiago-08/tp-paa architecture

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

- Interactive diagram: https://gitdiagram.com/thiago-08/tp-paa
- Repository: https://github.com/thiago-08/tp-paa

## Overview

This is a C++ graph and Boolean-formula solver suite. Users run one of four command-line programs on an instance: Clique solves directly; Independent Set complements the graph first; 3-SAT reduces the formula to a graph; and SAT first converts to 3-SAT. All routes rely on the shared Branch-and-Bound Clique solver, and the formula routes derive assignments from its result. A separate generator creates random graph or SAT instances. Edges reflect calls visible in excerpts; the README documents the generator’s use.

Main entry points: [`src/sat.cpp`](https://github.com/thiago-08/tp-paa/blob/main/src/sat.cpp) (SAT CLI), [`src/conjunto_independente.cpp`](https://github.com/thiago-08/tp-paa/blob/main/src/conjunto_independente.cpp) (Independent Set CLI), [`src/sat3.cpp`](https://github.com/thiago-08/tp-paa/blob/main/src/sat3.cpp) (3-SAT CLI), [`src/clique.cpp`](https://github.com/thiago-08/tp-paa/blob/main/src/clique.cpp) (Clique CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["CLI Solvers"]
  node_clique_cli["Clique CLI<br/>[clique.cpp]"]
  node_independent_cli["Independent Set CLI"]
  node_sat3_cli["3-SAT CLI<br/>[sat3.cpp]"]
  node_sat_cli["SAT CLI<br/>[sat.cpp]"]
  node_generator["Instance Generator<br/>[gerador.cpp]"]
end

subgraph group_reductions["Problem Reductions"]
  node_complement["Graph Complement<br/>[reducoes.hpp]"]
  node_sat_to_3sat["SAT to 3-SAT<br/>[reducoes.hpp]"]
  node_graph_reduction["3-SAT to Graph<br/>[reducoes.hpp]"]
  node_sat_via_clique["3-SAT via Clique<br/>[reducoes.hpp]"]
end

subgraph group_solver["Clique Solver"]
  node_clique_solver["Branch-and-Bound<br/>[clique_bb.hpp]"]
end

subgraph group_shared["Shared Utilities"]
  node_graph_reader["Graph Reader<br/>[util.hpp]"]
  node_formula_reader["Formula Reader<br/>[util.hpp]"]
  node_validators["Result Validators<br/>[util.hpp]"]
  node_formula_output["Assignment Output<br/>[util.hpp]"]
end

node_user(("User"))
node_instances["Input Instances"]

node_user -->|"runs"| node_clique_cli
node_user -->|"runs"| node_independent_cli
node_user -->|"runs"| node_sat3_cli
node_user -->|"runs"| node_sat_cli
node_user -->|"runs"| node_generator
node_instances -->|"provides graph"| node_clique_cli
node_instances -->|"provides graph"| node_independent_cli
node_instances -->|"provides formula"| node_sat3_cli
node_instances -->|"provides formula"| node_sat_cli
node_clique_cli -->|"reads graph"| node_graph_reader
node_independent_cli -->|"reads graph"| node_graph_reader
node_sat3_cli -->|"reads formula"| node_formula_reader
node_sat_cli -->|"reads formula"| node_formula_reader
node_independent_cli -->|"complements graph"| node_complement
node_independent_cli -->|"solves complement"| node_clique_solver
node_clique_cli -->|"solves graph"| node_clique_solver
node_sat3_cli -->|"solves formula"| node_sat_via_clique
node_sat_cli -->|"converts formula"| node_sat_to_3sat
node_sat_cli -->|"solves converted formula"| node_sat_via_clique
node_sat_to_3sat -->|"produces formula"| node_sat_via_clique
node_sat_via_clique -->|"builds graph"| node_graph_reduction
node_sat_via_clique -->|"searches for clique"| node_clique_solver
node_clique_cli -->|"checks clique"| node_validators
node_independent_cli -->|"checks set"| node_validators
node_sat3_cli -->|"checks assignment"| node_validators
node_sat_cli -->|"checks assignment"| node_validators
node_sat3_cli -->|"prints assignment"| node_formula_output
node_sat_cli -->|"prints assignment"| node_formula_output

click node_instances "https://github.com/thiago-08/tp-paa/tree/main/instancias"
click node_clique_cli "https://github.com/thiago-08/tp-paa/blob/main/src/clique.cpp"
click node_independent_cli "https://github.com/thiago-08/tp-paa/blob/main/src/conjunto_independente.cpp"
click node_sat3_cli "https://github.com/thiago-08/tp-paa/blob/main/src/sat3.cpp"
click node_sat_cli "https://github.com/thiago-08/tp-paa/blob/main/src/sat.cpp"
click node_generator "https://github.com/thiago-08/tp-paa/blob/main/src/gerador.cpp"
click node_complement "https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp"
click node_sat_to_3sat "https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp"
click node_graph_reduction "https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp"
click node_sat_via_clique "https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp"
click node_clique_solver "https://github.com/thiago-08/tp-paa/blob/main/src/clique_bb.hpp"
click node_graph_reader "https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp"
click node_formula_reader "https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp"
click node_validators "https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp"
click node_formula_output "https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp"

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_clique_cli,node_independent_cli,node_sat3_cli,node_sat_cli,node_generator,node_user toneBlue
class node_complement,node_sat_to_3sat,node_graph_reduction,node_sat_via_clique toneAmber
class node_clique_solver toneMint
class node_graph_reader,node_formula_reader,node_validators,node_formula_output toneRose
class node_instances toneTeal
```

## Components

### CLI Solvers

- [Clique CLI](https://github.com/thiago-08/tp-paa/blob/main/src/clique.cpp): `src/clique.cpp`
- [Independent Set CLI](https://github.com/thiago-08/tp-paa/blob/main/src/conjunto_independente.cpp): `src/conjunto_independente.cpp`
- [3-SAT CLI](https://github.com/thiago-08/tp-paa/blob/main/src/sat3.cpp): `src/sat3.cpp`
- [SAT CLI](https://github.com/thiago-08/tp-paa/blob/main/src/sat.cpp): `src/sat.cpp`
- [Instance Generator](https://github.com/thiago-08/tp-paa/blob/main/src/gerador.cpp): `src/gerador.cpp`

### Problem Reductions

- [Graph Complement](https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp): `src/reducoes.hpp`
- [SAT to 3-SAT](https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp): `src/reducoes.hpp`
- [3-SAT to Graph](https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp): `src/reducoes.hpp`
- [3-SAT via Clique](https://github.com/thiago-08/tp-paa/blob/main/src/reducoes.hpp): `src/reducoes.hpp`

### Clique Solver

- [Branch-and-Bound](https://github.com/thiago-08/tp-paa/blob/main/src/clique_bb.hpp): `src/clique_bb.hpp`

### Shared Utilities

- [Graph Reader](https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp): `src/util.hpp`
- [Formula Reader](https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp): `src/util.hpp`
- [Result Validators](https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp): `src/util.hpp`
- [Assignment Output](https://github.com/thiago-08/tp-paa/blob/main/src/util.hpp): `src/util.hpp`

### Other components

- **User**
- [Input Instances](https://github.com/thiago-08/tp-paa/tree/main/instancias): `instancias`

## Connections

- User → Clique CLI: runs (evidence: `README.md`)
- User → Independent Set CLI: runs (evidence: `README.md`)
- User → 3-SAT CLI: runs (evidence: `README.md`)
- User → SAT CLI: runs (evidence: `README.md`)
- User → Instance Generator: runs (evidence: `README.md`)
- Input Instances → Clique CLI: provides graph (evidence: `README.md`)
- Input Instances → Independent Set CLI: provides graph (evidence: `README.md`)
- Input Instances → 3-SAT CLI: provides formula (evidence: `README.md`)
- Input Instances → SAT CLI: provides formula (evidence: `README.md`)
- Clique CLI → Graph Reader: reads graph (evidence: `src/clique.cpp`)
- Independent Set CLI → Graph Reader: reads graph (evidence: `src/conjunto_independente.cpp`)
- 3-SAT CLI → Formula Reader: reads formula (evidence: `src/sat3.cpp`)
- SAT CLI → Formula Reader: reads formula (evidence: `src/sat.cpp`)
- Independent Set CLI → Graph Complement: complements graph (evidence: `src/conjunto_independente.cpp`)
- Independent Set CLI → Branch-and-Bound: solves complement (evidence: `src/conjunto_independente.cpp`)
- Clique CLI → Branch-and-Bound: solves graph (evidence: `src/clique.cpp`)
- 3-SAT CLI → 3-SAT via Clique: solves formula (evidence: `src/sat3.cpp`)
- SAT CLI → SAT to 3-SAT: converts formula (evidence: `src/sat.cpp`)
- SAT CLI → 3-SAT via Clique: solves converted formula (evidence: `src/sat.cpp`)
- SAT to 3-SAT → 3-SAT via Clique: produces formula (evidence: `README.md`)
- 3-SAT via Clique → 3-SAT to Graph: builds graph (evidence: `src/reducoes.hpp`)
- 3-SAT via Clique → Branch-and-Bound: searches for clique (evidence: `src/reducoes.hpp`)
- Clique CLI → Result Validators: checks clique (evidence: `src/clique.cpp`)
- Independent Set CLI → Result Validators: checks set (evidence: `src/conjunto_independente.cpp`)
- 3-SAT CLI → Result Validators: checks assignment (evidence: `src/sat3.cpp`)
- SAT CLI → Result Validators: checks assignment (evidence: `src/sat.cpp`)
- 3-SAT CLI → Assignment Output: prints assignment (evidence: `src/sat3.cpp`)
- SAT CLI → Assignment Output: prints assignment (evidence: `src/sat.cpp`)
