There is a computer network with N nodes and N-1 connection link. Each connection link has a time associated with it.
We are given a initial network setup As shown in the figure. Computers are connected with two way links.
Network time is defined as the maximum of the time between any pair of the Nodes(computers).
In the given figure, network time is 25 (Node 5, 2, 3, 6).
Our task is to maximize this network time by removing exact one edge and adding this edge at any other place. Condition is :
1. One or both ends of the edge can be removed and added.
2. after this operation network will be a spanning tree and there exists only one path between each pair of vertices.
The above network can be converted as below figure to achieve maximum network time to 25.
Constraints are:
N, number of computer(nodes) between 4 and 2000.
Desirable: Optimal solution with execution time with in 1sec for (C and C++).