-2

onsider a graph of five vertices whose vertices are labelled 1 to 5. The only edges present in the graph are one each from 1 to 2, 1 to 3, 1 to 4 and 1 to 5. Let the time taken to travel from 1 to 2, 3, 4 and 5 be 5, 5, 1 and 1 units respectively. Also assume that if it takes time t to travel from vertex a to b, then it takes the same time to travel from b to a.We wish to select a walk from vertex 1 to some other vertex, back to vertex 1 and so on till each vertex (except vertex 1 - the source) is visited exactly once.

Let the initial instant be t = 0. Let the times of visit of vertices 2, 3, 4 and 5 from t = 0 be t2, t3, t4 and t5.We wish to minimise the sum of t2, t3, t4 and t5.

Find out the minimum possible sum of the given times.

Geeky
  • 21
  • 6

3 Answers3

0

i am unable to understand the question itself

This is my understanding of the question:

If you visit nodes 2, 3 ,4, and 5 in that order, the times will be:

t2 = 5 (going from 1 to 2),   
t3 = 15 (5 to get to 2, 5 to return from 2 back to 1, and 5 to go from 1 to 3),  
t4 = 21 (15 + 5 + 1),  
t5 = 23 (21 + 1 + 1).  

The sum is 64. You can get a better time with a different order, your task is to find the best (minimum) sum.

Ella Blackledge
  • 329
  • 1
  • 7
0

To minimise the total time of visiting, we select the path which takes minimum time first because this time piles up on all other vertices. After we come back to 1,we then select the path with second minimum time and we repeat this process each time after we come back to 1.

Let the times in sorted order be a,b,c and d for vertices v1,v2,v3 and v4. Then vertex v1 is visited at time t = a.We come back to 1 at t = 2a.We then reach the second vertex at t = 2a + b and come back to 1 at t = 2a + 2b. Continuing similarly, vertex v3 is visited at t = 2a + 2b + c and v4 is visited at t = 2a + 2b + 2c + d. So, the minimum value of the sum of times would be 7a + 5b + 3c + d.

So, the answer is 32.

Geeky
  • 21
  • 6
0
so can we start the walk with vertex 5 =1+1=2  
vertex 4 = 1+1=2  
vertex 3=5+5=10  
vertex 2= 5  
total=2+2+10+5=19  

Note that your total never changes, no matter the order in which you visit the nodes, so you cannot minimize it. You may want to clarify this with the teacher, but the problem definition states "time instance," not duration.

Think of it as starting a timer at time t-1 Then, for your path above (t-1 = 0): t-5(vertex-5) = 1, t-4 = 3, t-2 = 9, t-3 = 19. The sum is 32. Much better than 64, so you are on the right track!

Dijkstra's is used to find the shortest path between nodes, and it doesn't apply here. This problem is much easier.

Ella Blackledge
  • 329
  • 1
  • 7