Ask Your Question

Revision history [back]

You can give a name toyour graph and then use the relabel method:

sage: G = graphs.RandomGNM(4,5)
sage: G.vertices()
[0, 1, 2, 3]
sage: G.relabel({0:'zero' , 1:'one', 2:'two', 3:'three'})
sage: G.vertices()
['one', 'three', 'two', 'zero']
sage: G.show(figsize=[4,4], graph_border=True)
Launched png viewer for Graphics object consisting of 11 graphics primitives

You can give a name toyour to your graph and then use the relabel method:

sage: G = graphs.RandomGNM(4,5)
sage: G.vertices()
[0, 1, 2, 3]
sage: G.relabel({0:'zero' , 1:'one', 2:'two', 3:'three'})
sage: G.vertices()
['one', 'three', 'two', 'zero']
sage: G.show(figsize=[4,4], graph_border=True)
Launched png viewer for Graphics object consisting of 11 graphics primitives