I have a dictionary which represents graph. Key is Node class and values are set of Nodes. So it has this structure:
dict[Node] = {Node, Node, Node}
class Node:
def __init__(self, row, column, region):
self.id = f'{str(row)}-{str(column)}'
self.region = region
self.visited = False
In code below I need to update visited property of Node class.
while nodes_queue:
current_node = nodes_queue.pop()
for edge in self.map[current_node]:
if edge.region == root.region and not edge.visited:
edge.visited = True # Not updated!
nodes_queue.append(edge)
But it looks like I get view of Node objects instead of actual objects. When I update visited property in for loop and get it from next iteration, the property is still set to False