I have been working on the problem for some time. The solution I thought was to calculate mst of the given graph and calculate the cost. Then apply dijkshtra on it and calculate the minimum cost for each vertex from 0. And check if they are same or not considering the edges cases(such as graph is not connected). Any help would be appreciated.
Solution Link : Sol. Link