So I got this really cool book from university library today, Python Algorithms by Magnus Lie Hetland and in the Chapter second of the book he creates the adjacency list as follows, which was kind of cool:
a,b,c,d,e,f,g,h = range(8)
N = [{b,c,d,e,f},{c,e},{d},{e},{f},{c,g,h},{f,h},{f,g}]
And when I do:
N[a]
I get the first element of N, and it's kind of surprising me how did it got mapped in such a manner?
I found this question but it's different than what I am asking still let me know if it's a duplicate.
Adjacency List and Adjacency Matrix in Python
Thanks, Prerit