Oct-25-2016, 06:23 PM
...? Building dicts isn't hard. And if your keys are all sequentially numerical, you can also use a list.
# dict graph = { 1: [2], 2: [3, 4], 3: [1], 4: [4, 5] } # list other_graph = [ [], # 0 [2], # 1 [3, 4], [1], [4, 5] ] print(graph) print(other_graph)