| 1 | initial version |
There is a method called relabel for that:
sage: g = Graph([('a','b'), ('b','c')])
sage: g.vertices()
['a', 'b', 'c']
sage: g.relabel()
sage: g.vertices()
[0, 1, 2]
sage: g.edges()
[(0, 1, None), (1, 2, None)]
To make sure of what it does, you may provide the permutation yourself as a dictionary:
sage: g = Graph([('a','b'), ('b','c')])
sage: g.relabel({'a':1,'b':2,'c':0})
sage: g.edges()
[(0, 2, None), (1, 2, None)]
See documentation of relabel method which has many options.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.