Return string of tail vertices in set notation. >>> g = Graph() >>> g.add(1, [1, 3, 4]) >>> print g[1] {1, 3, 4}
(self)
| 337 | super(Vertex, self).__setitem__(tail, True) |
| 338 | |
| 339 | def __str__(self): |
| 340 | """Return string of tail vertices in set notation. |
| 341 | |
| 342 | >>> g = Graph() |
| 343 | >>> g.add(1, [1, 3, 4]) |
| 344 | >>> print g[1] |
| 345 | {1, 3, 4} |
| 346 | """ |
| 347 | if _DEBUG: self._validate() |
| 348 | if not self: return '{}' #nothing to sort |
| 349 | keys = self.keys() |
| 350 | keys.sort() |
| 351 | return '{%s}' % ', '.join(map(repr, keys)) |
| 352 | |
| 353 | |
| 354 | def MERGE_VERTEX(g, h, vert): g[h].update(vert) |