Recently in a coding test, I encountered a question based on graphs which I was unable to solve.
So in the question, we were given a road network (a weighted undirected graph), roads were represented by edges (and they had some weight) and cities were represented by vertices. Also we were given a list of proposed roads (i.e. 3 numbers, 2 end-points/cities it connected and other number was the weight) that can be added in the given road network. We had to tell which road upon adding to the network minimized the total travelling distance in the network. Total travelling distance was defined as the sum of the shortest path distances between all pairs of cities. Constraints:
No. of vertices: 100, No. of edges: 1000, No. of road proposals: 1000.
What would be the most efficient approach to solve this problem?