Add weights to graph edges. Choose between edges based on their weight.