1    class Vertex:
2        '''
3        Class for representing vertex structure for a graph.
4        '''
5        __slots__ = '_element'
6
7        def __init__(self, x):
8            '''
9            Do not call constructor directly. Use Graph's insert_vertex(x).
10           '''
11           self._element = x
12        def element(self):
13           '''
14           Return element associated with this vertex.
15           '''
15           return self._element
16        def __hash__(self):
17           '''
18           will allow vertex to be a map/set key
19           '''
20           return hash(id(self))