I am working with a diagram that includes nodes A, B, C and several edges connecting these nodes.
How can I extract the distinct pairs (A, B), (A, C), (B, C)?
One potential method is:
visited = [];
for item1 in nodes:
for item2 in nodes:
if (item1, item2) not in visited:
visited.push((item1, item2))
..
However, could there be a more efficient approach to accomplishing this task?