From 37355ba95134322ead021618aa59667db208638f Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Tue, 18 Feb 2025 12:06:57 +0100 Subject: [PATCH] Changed wrong logic --- src/graph/GraphView.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp index 26c693152..b0d7336e2 100644 --- a/src/graph/GraphView.cpp +++ b/src/graph/GraphView.cpp @@ -1115,16 +1115,19 @@ void Aidge::GraphView::insertParent(NodePtr childNode, } bool Aidge::GraphView::replace(const std::set<Aidge::NodePtr>& oldNodes, const std::set<Aidge::NodePtr>& newNodes) { - AIDGE_ASSERT(!(oldNodes.size() > 1 && newNodes.size() > 1), - "GraphView::replace(): old and new sets cannot both have more than one node (here: {} and {} respectively). Use GraphView instead of set in this case.", - oldNodes.size(), newNodes.size()); - // (1) create GraphViews from both sets of Nodes auto oldG = std::make_shared<GraphView>("oldG"); oldG->add(oldNodes, false); auto newG = std::make_shared<GraphView>("newG"); newG->add(newNodes, false); + AIDGE_ASSERT(!(oldG->getOrderedInputs().size() > 1 || newG->getOrderedInputs().size() > 1), + "GraphView::replace(): old and new sets cannot have more than one input node (here: {} and {} respectively). Use GraphView instead of set in this case.", + oldG->getOrderedInputs().size(), newG->getOrderedInputs().size()); + AIDGE_ASSERT(!(oldG->getOrderedOutputs().size() > 1 || newG->getOrderedOutputs().size() > 1), + "GraphView::replace(): old and new sets cannot have more than one output node (here: {} and {} respectively). Use GraphView instead of set in this case.", + oldG->getOrderedOutputs().size() , newG->getOrderedOutputs().size()); + return GraphView::replace(oldG, newG); } -- GitLab