diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp index 26c693152f18270d3cb4012567b9b6bd69772bb6..b0d7336e217dfd4067ee95b09e595a74a58116b4 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); }