Im not really sure what you are trying to accomplish. Are you trying to retain Edge in the dictionary?
Also regarding your naming conventions
http://python-forum.io/Thread-Basic-Nami...ions-PEP-8
for x in V: Graph[x.v1] = x.v2
Quote:TypeError: list indices must be integers, not EdgeTheres not much else to say. List indices must be an int, whereas you are sending an Edge object. You shoudnt need to do this anyways, as python for loops iterates the objects within. Here x is each Edge object as it iterates through the list. Rarely do you need the index.
Also regarding your naming conventions
http://python-forum.io/Thread-Basic-Nami...ions-PEP-8
Recommended Tutorials: