A copyable, self-contained circuit graph: every node of one forward pass with an ablation importance score, plus the weighted edges between them.
More...
#include <circuit_graph.hpp>
A copyable, self-contained circuit graph: every node of one forward pass with an ablation importance score, plus the weighted edges between them.
- Note
- Data only: this type has no drawing or file code and no dependency on a visualization stack. viz/document.hpp converts it to and from JSON (
pulsatrix.circuit_graph.v1, ToCircuitGraphDocument / ToCircuitGraph), and CircuitGraphView (viz/circuit_graph_view.hpp, PULSATRIX_ENABLE_VIZ) draws it.
-
Holds no reference to the ComputationGraph or ExplainerContext it was built from, for the same reason ActivationSnapshot does not: ExplainerContext replaces its graph wholesale on every forward pass, so a circuit that referred back to either would be invalidated by the very next one. Copying the small per-node metadata instead makes the artifact outlive the analysis that produced it.
-
Constructed by ExplainerContext::build_circuit_graph(), not assembled by hand.
◆ CircuitGraph()
Constructs a circuit graph from already-computed nodes and edges.
- Parameters
-
| nodes | Scored nodes, in topological order. |
| edges | Weighted edges. |
- Note
- No cross-validation between the two arguments (e.g. that every edge endpoint names a node in the list): this constructor is reached only from ExplainerContext::build_circuit_graph(), which builds both from one consistent graph in a single pass – the same rationale ActivationSnapshot's constructor documents. An empty circuit, and a single-node/zero-edge circuit, are both well-formed values rather than errors; the latter is what a one-node graph genuinely produces.
◆ edges()
| const std::vector< CircuitEdge > & pulsatrix::CircuitGraph::edges |
( |
| ) |
const |
|
inline |
Every weighted edge, in source-node order as of build time.
◆ nodes()
| const std::vector< CircuitNode > & pulsatrix::CircuitGraph::nodes |
( |
| ) |
const |
|
inline |
Every scored node, in topological order as of build time.
The documentation for this class was generated from the following file: