How to change edges' weight by designated rule? How to change edges' weight by designated rule? python python