[core][graph] store duplication result in an OrderedDict

allows to keep the order in which duplicated nodes were created
This commit is contained in:
Yann Lanthony 2018-07-27 19:05:25 +02:00
parent e6e2c18aa8
commit 41ea5a5423

View file

@ -5,7 +5,7 @@ import logging
import os
import re
import weakref
from collections import defaultdict
from collections import defaultdict, OrderedDict
from contextlib import contextmanager
from enum import Enum
@ -363,10 +363,11 @@ class Graph(BaseObject):
fromNode (Node): the node to start the duplication from
Returns:
Dict[Node, Node]: the source->duplicate map
OrderedDict[Node, Node]: the source->duplicate map
"""
srcNodes, srcEdges = self.nodesFromNode(fromNode)
duplicates = {}
# use OrderedDict to keep duplicated nodes creation order
duplicates = OrderedDict()
with GraphModification(self):
duplicateEdges = {}