roads = set()
connections = [[0,1],[1,3],[2,3],[4,0],[4,5]]
for u, v in connections:
roads.add((u, v))
print(roads)
result:
{(0, 1)}
{(0, 1), (1, 3)}
{(0, 1), (2, 3), (1, 3)}
{(0, 1), (4, 0), (2, 3), (1, 3)}
{(0, 1), (4, 0), (2, 3), (4, 5), (1, 3)}
is the order it gets added to the set random? at first i thought it was placing them into the roads set at the index of 1, but then in the last print statement, it adds to the set at index 3.