Added event handlers to change edge weight.