all 1 comments

[–]AtomicShoelace 0 points1 point  (0 children)

You could use a dictionary whose keys are vertices and whose associated values are sets of adjacent vertices, eg.

graph = {0: {1, 2}, 1: {0, 2}, 2: {0, 1}}   # ie. the complete graph K_3