Implementation of MnaGraph: node management, port connectivity, schema-aware validation, Kahn topological sort and JSON/CBOR round-trip. More...
#include "mna_graph.h"#include "mna_op_registry.h"#include <QJsonArray>#include <QCborArray>#include <QSet>#include <QQueue>
Go to the source code of this file.
Implementation of MnaGraph: node management, port connectivity, schema-aware validation, Kahn topological sort and JSON/CBOR round-trip.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
The implementation backs the graph with a single QList of MnaNode and resolves node ids through linear search, which stays cheap at the pipeline sizes MNA targets (tens to hundreds of nodes). MnaGraph::validate walks the node list, queries MnaOpRegistry for each opType, runs the per-node MnaOpSchema::validate, then sweeps the inter-node edges to check that every required input port is wired and that the MnaDataKind on both ends agrees.
MnaGraph::topologicalSort implements Kahn's algorithm over the input-port sourceNodeId references and surfaces an empty list when a cycle is present, which the validator turns into an explicit error. upstreamNodes / downstreamNodes use a QQueue-driven BFS to support incremental re-execution, and the JSON / CBOR codecs delegate every nested struct to its own codec so a project survives a round trip without loss.
Definition in file mna_graph.cpp.