Weighted graph is added and MST as well