Convergence of Weighted-average consensus for undirected graphs