Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write in java Problem Description Given a graph consisting of N vertices and M edges. There is a treasure on every vertex of the graph

image text in transcribed

image text in transcribed

write in java

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 treasure from 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[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 XB[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. Problem Constraints 1N=5001M=1031A[=10151B[c

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

Step: 3

blur-text-image

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 28th British National Conference On Databases Bncod 28 Manchester Uk July 2011 Revised Selected Papers Lncs 7051

Authors: Alvaro A.A. Fernandes ,Alasdair J.G. Gray ,Khalid Belhajjame

2011th Edition

3642245765, 978-3642245763

More Books

Students also viewed these Databases questions

Question

3. List ways to manage relationship dynamics

Answered: 1 week ago