Ask Your Question

Revision history [back]

Of course you would have to specify which label will be replaced by 'd'. I did not found such a method in Sage (and unfortunately the .set_edge_label() method does not offer the possibility to specify which edge you would like to relabel), but you can always fallback to:

sage: G.edges()
[(0, 0, 'a'), (0, 0, 'b'), (0, 0, 'c')]
sage: G.delete_edge((0,0,'b'))
sage: G.add_edge((0,0,'d'))
sage: G.edges()
[(0, 0, 'a'), (0, 0, 'c'), (0, 0, 'd')]