add weight to edges