Add weights to edges in graph