Skip to content
Snippets Groups Projects

Use createUniqueName() while adding nodes from a Graphview to another.

1 unresolved thread

Context

The

bool GraphView::add(std::shared_ptr<GraphView> otherGraph,
             bool includeLearnableParam = true);

function does not check for duplicate node names before adding nodes from a given Graphview to another Graphview.

Modified files

  • aidge_core/src/graph/GraphView.cpp, to add a condition that checks for duplicate node names in the target Graphview and uses createUniqueName() if a duplicate is found;
Edited by Cyril Moineau

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
684 685 node->addView(shared_from_this());
685 686 mNodes.insert(node);
686 if (!(node->name()).empty())
687 mNodeRegistry.insert(std::make_pair(node->name(), node));
687 if (!(node->name()).empty()) {
688 // Check if a node with the same name exists in the registry
689 auto it = mNodeRegistry.find(node->name());
690 if (it != mNodeRegistry.end()) {
691 // Found a node with the same name, check if it's the same node pointer
692 if (it->second.get() == node.get()) {
693 Log::debug("Node \"{}\" is already registered and is the same instance. Skipping insertion.\n", node->name());
694 } else {
695 // Different instance with the same name – generate an unique name
696 std::string newName = node->createUniqueName(node->name());
697
698 while (mNodeRegistry.find(newName) != mNodeRegistry.end()) {
  • added 13 commits

    • 4d3daaff...578c0429 - 10 commits from branch eclipse/aidge:dev
    • d8c7ca6c - Employ createUniqueName() in the add() function.
    • a751db03 - Corrected logic of creating unique names in the GraphView.add() method.
    • c35b4940 - Added actual pointer comparison while creating unique names in the GraphView.add() method.

    Compare with previous version

  • added 1 commit

    • 16a70b56 - Removed unnecessary while-loop when checking for duplicate node names.

    Compare with previous version

  • added 13 commits

    • 16a70b56...19cd7d0f - 9 commits from branch eclipse/aidge:dev
    • 6480c7ba - Employ createUniqueName() in the add() function.
    • e547e7bc - Corrected logic of creating unique names in the GraphView.add() method.
    • 3ee5e5f4 - Added actual pointer comparison while creating unique names in the GraphView.add() method.
    • 35e3ff55 - Removed unnecessary while-loop when checking for duplicate node names.

    Compare with previous version

  • added 1 commit

    • 67b9e164 - Removed redudant code in GraphView's add() methods.

    Compare with previous version

  • @idealbuq Is this ready to be merged?

  • I think so... I have made the suggested modifications, but don't hesitate to take a look.

  • Cyril Moineau added 9 commits

    added 9 commits

    • 67b9e164...a6a93847 - 4 commits from branch eclipse/aidge:dev
    • 8e203946 - Employ createUniqueName() in the add() function.
    • d38a7d11 - Corrected logic of creating unique names in the GraphView.add() method.
    • 6716d3f4 - Added actual pointer comparison while creating unique names in the GraphView.add() method.
    • f4f694c6 - Removed unnecessary while-loop when checking for duplicate node names.
    • 5916d89e - Removed redudant code in GraphView's add() methods.

    Compare with previous version

  • Cyril Moineau enabled an automatic merge when all merge checks for 5916d89e pass

    enabled an automatic merge when all merge checks for 5916d89e pass

  • merged

  • Please register or sign in to reply
    Loading