'Set or replace all nodes. The given nodes must be in a
list or set where each item is a tuple of the form:
(nodeId, sourceId, cacheType)
Arguments:
nodes -- A series of nodes in tuple format.'

def set_nodes(self, nodes):

    self.del_nodes()
    for node in nodes:
        if isinstance(node, RequestNode):
            self.add_node(node['nodeId'], node['sourceId'], node['cacheType'])
        else:
            (nodeId, sourceId, cacheType) = node
            self.add_node(nodeId, sourceId, cacheType)
