fixing weighted graph