Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a graph consisting of N vertices and M edges. There is a treasure on every vertex of the graph which has a price of

Given a graph consisting of N vertices and M edges. There is a treasure on every vertex of the graph which has a price of A[i] and weight of Bli]. For each vertex v you have to determine the minimum cost to collect the treasure from any vertex u (u may or may not be egaul to v). The cost for vertex v to collect the treasure from u has mainly four components.

1. The price A[u] of the treasure at vertex u.

2. The sum of weights of all the edges in the path from v to u

3. The sum of weights of all the edges in the path from u to v

4. An additional cost of X*B[u] is also added, where X is the number of edges traversed on the path from u to v

Notes

1. The ith bidirectional edge goes from C[i][0] to C[i][1] and has a weight of C[i][2] 2. The path to go from v to u and to comeback to v from u may or may not be same.

3 There might be multiple edges and self loops

image text in transcribed

image text in transcribed

image text in transcribed

Problem Description Given a graph consisting of N vertices and M edges. There is a treasure on every vertex of the graph which has a price of A[i] and weight of B[i]. For each vertex v you have to determine the minimum cost to collect the treassure fromi any vertex u (u may or may not be eqaul to v ). The cost for vertex v to collect the treasure from u has mainly four components. 1. The price A[a] of the titreasure lat vertex . 2. The sum of weightsiof all the edges in the path from vi to u. 3. The sum of weights of all the edges in the path from u to v. 4. An additional cost of XB[u ) is alsol ladded, where X is the number of edges traversed on the path from u to v. Notes 1. The ith bidirectional edge goes from c[i][0] to Cli] [1] and has a weight of C[i][2]. 2. The path to go from v to u and to to comeback to v from u may or may not be same. 3. There might be multiple,edges and selfilaops, Problem Constraints 1=N

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions