Throw exception for invalid argument in add_e and decrease_w