|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Undirected graph on ACIR witness indices; connected components = "ACIR components". More...
#include <acir_graph.hpp>
Public Member Functions | |
| void | process_acir_circuit (const Acir::Circuit &circuit) |
Walk circuit.opcodes, populate adjacency, then merge per-block memory witnesses. | |
| std::unordered_map< uint32_t, size_t > | get_witness_component_map () const |
| Map each witness that appears in at least one edge to a component id. | |
Private Member Functions | |
| void | add_constraint (const std::vector< uint32_t > &witnesses) |
| Add a clique on the given witness indices (deduplicated). Empty or singleton → no edges. | |
| std::vector< std::vector< uint32_t > > | find_components () const |
Iterative DFS over adjacency_lists_; each inner vector is one component's vertices. | |
Private Attributes | |
| std::unordered_map< uint32_t, std::unordered_set< uint32_t > > | adjacency_lists_ |
Undirected graph on ACIR witness indices; connected components = "ACIR components".
Vertices are witness indices (Noir/ACIR numbering). Each opcode contributes one hyperedge: every witness that appears in that opcode is pairwise-adjacent, so the component captures "must be wired together at the ACIR level".
Opcode coverage matches the structural links we care about for debugging serde/synthesis: AssertZero, black-box calls (witness inputs/outputs only — constants are skipped by collectors), and memory blocks (MemoryInit / MemoryOp per block, merged into one edge set per block). BrilligCall and Call add no edges (Brillig is unconstrained ACIR; calls are not expanded here).
Definition at line 30 of file acir_graph.hpp.
|
private |
Add a clique on the given witness indices (deduplicated). Empty or singleton → no edges.
Definition at line 59 of file acir_graph.cpp.
|
private |
Iterative DFS over adjacency_lists_; each inner vector is one component's vertices.
Definition at line 80 of file acir_graph.cpp.
| std::unordered_map< uint32_t, size_t > acir_components_check::AcirGraph::get_witness_component_map | ( | ) | const |
Map each witness that appears in at least one edge to a component id.
IDs are 0 .. N-1 where N is the number of connected components in iteration order over adjacency_lists_ (order is deterministic for a given graph build, but not semantically meaningful). Isolated witnesses (never referenced) do not appear in the map.
Definition at line 112 of file acir_graph.cpp.
| void acir_components_check::AcirGraph::process_acir_circuit | ( | const Acir::Circuit & | circuit | ) |
Walk circuit.opcodes, populate adjacency, then merge per-block memory witnesses.
Definition at line 124 of file acir_graph.cpp.
|
private |
Definition at line 47 of file acir_graph.hpp.