Problem: Minimum Valid Path The goal of this assessment is to use appropriate data structures and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem: Minimum Valid Path The goal of this assessment is to use appropriate data structures and write algorithms to solve the minimum valid path problem. The problem is to find the minimum cost of a valid path between two given vertices in a weighted directed graph with some vertices marked as special that contains exactly one special vertex and also satisfy a particular condition on the weighting of adjacent edges as explained below. This problem resembles the problem of finding a path with minimum cost to travel between two places where the path includes exactly one special place. Learning outcome Critically analyse a specific topic whilst applying the underlying principles and concepts to the field of study Task: You are given a weighted directed graph some of whose vertices are marked as special vertices. A valid path in it is a path which satisfies the following conditions: 1. For any two adjacent edges x and y on the path, 0.5*weight(x) <= weight(y) <= 2*weight(x) 2. The path contains exactly one special vertex. Given two vertices x and y, your task is to calculate the minimum cost of a valid path between them. Input Format First line: n and m, the number of vertices and the number of edges in the graph. (1≤ n s 1000, 1sm s 5000) Next m lines contain three integers u, v, and w representing an edge from vertex u to vertex V, with a weight of w. (1su, vs n, 1s w≤ 10000) Next line contains an integer k which is the number of special vertices. (15 ks n) Next line contains k distinct integers, the indices of the special vertices. (15 index ≤ n) The last line contains the integers x and y, the source and destination vertices. (1s x, ys n) Note: Graph can have multiple edges between two vertices. Output Format If there is no valid path from x toy output -1, else output the path and the minimum cost of a valid path from x to y. Sample Input 44 121 231 341 131 1 4 14 Sample Output Path: 1-3-4 Min. cost= 2 4 1 1 1 Explanation In the given sample, it is clear that path 1-3-4 is a valid path with cost 2. Though 1-2- 3-4 is also a valid path, but its cost is 3. So, 2 is the minimum cost of a valid path. Submission Submit your code and supporting Microsoft word or pdf document including screenshots of the code and brief narrative about the algorithm and utilized data structures to Moodle. You will be also required to demo your work in the class. Problem: Minimum Valid Path The goal of this assessment is to use appropriate data structures and write algorithms to solve the minimum valid path problem. The problem is to find the minimum cost of a valid path between two given vertices in a weighted directed graph with some vertices marked as special that contains exactly one special vertex and also satisfy a particular condition on the weighting of adjacent edges as explained below. This problem resembles the problem of finding a path with minimum cost to travel between two places where the path includes exactly one special place. Learning outcome Critically analyse a specific topic whilst applying the underlying principles and concepts to the field of study Task: You are given a weighted directed graph some of whose vertices are marked as special vertices. A valid path in it is a path which satisfies the following conditions: 1. For any two adjacent edges x and y on the path, 0.5*weight(x) <= weight(y) <= 2*weight(x) 2. The path contains exactly one special vertex. Given two vertices x and y, your task is to calculate the minimum cost of a valid path between them. Input Format First line: n and m, the number of vertices and the number of edges in the graph. (1≤ n s 1000, 1sm s 5000) Next m lines contain three integers u, v, and w representing an edge from vertex u to vertex V, with a weight of w. (1su, vs n, 1s w≤ 10000) Next line contains an integer k which is the number of special vertices. (15 ks n) Next line contains k distinct integers, the indices of the special vertices. (15 index ≤ n) The last line contains the integers x and y, the source and destination vertices. (1s x, ys n) Note: Graph can have multiple edges between two vertices. Output Format If there is no valid path from x toy output -1, else output the path and the minimum cost of a valid path from x to y. Sample Input 44 121 231 341 131 1 4 14 Sample Output Path: 1-3-4 Min. cost= 2 4 1 1 1 Explanation In the given sample, it is clear that path 1-3-4 is a valid path with cost 2. Though 1-2- 3-4 is also a valid path, but its cost is 3. So, 2 is the minimum cost of a valid path. Submission Submit your code and supporting Microsoft word or pdf document including screenshots of the code and brief narrative about the algorithm and utilized data structures to Moodle. You will be also required to demo your work in the class.
Expert Answer:
Answer rating: 100% (QA)
To solve the Minimum Valid Path problem you can use Dijkstras algorithm with some modifications to m... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Data set Theory Assume an informational record with one association parent including matches (a, b) where a can't try not to be a parent of b. (a) Write a Datalog demand which gives the graph of...
-
Let r and s be solutions to the quadratic equation x 2 b x + c = 0. For n N, define d0 = 0 d1 = r s dn = b dn1 c dn2 (n 2) Prove that dn = r n s n for all n N. [4 marks] (b) Recall that a commutative...
-
Compute the determinant below. 14 8 8 8 51 1000 8 7 3 0 0 0 8 8 8 8 8 2
-
Your best friend is considering making an investment in Photometric Tailoring Co. She seeks your advice in interpreting the company's information. Specifically, she asks whether this trial balance...
-
nces Empire Airlines reports the following cost data for the year. The company flew 100 private flights during the year. A group has offered Empire $13,000 for a private flight to Chicago for its...
-
A researcher wants to determine whether children are more likely to be born on certain days of the week. She will sample 350 births and record the day of the week for each. The null hypothesis is...
-
Continental Photo, Inc., is a portrait photography company. Alex Riley, a black man, applied for a position as a photographer with Continental. Riley submitted an application and was interviewed. In...
-
A manager would like to develop a funds concentration policy for her staff to use to determine when to transfer funds using a wire transfer or an ACH transfer. The pertinent information appears...
-
Find (a) the covariance, (b) the correlation coefficient of two random variables X and Y if E(X) = 2, E(Y) = 3, E(XY) = 10, E(X) = 9, E(Y) = 16.
-
Please refer to the case study of Banorte Movil: Data-Driven Mobile Growth. 1. What should Banorte do to improve its mobile app adoption rates? Can Banorte Mvil reach its 4-million-user goal by 2020?...
-
Bautista Corporation issued $550,000, 12%, 15-year bonds on January 1, 2022, for $1,259,712 when the market interest rate was 2%. Interest is paid semiannually on January 1 and July 1. The...
-
How is process evaluation different from outcome evaluation? Why study process evaluation and when can it be useful? (Name one item each, and leave room for classmates to add their own.) What types...
-
Does the Clark-Wilson policy address confidentiality or integrity? Can it also be implemented with the mechanisms available in Unix-like systems? Explain your answer.
-
Suppose Rocky Brands has earnings per share of $2.42 and EBITDA of $29.2 million. The firm also has 5.8 million shares outstanding and debt of $120 million (net of cash). You believe Jared's Outdoor...
-
At Carpenter Depot Warehouse they sell lumber board scut to the length desired by the customer. All numeric values are the whole number of positive integers in units of inches Show a block of...
-
5. How much would you need to deposit in an account now in order to have $5,000 in the account in 5 years? Assume the account earns 2% interest compounded monthly. 10. You deposit $300 each month...
-
Briefly describe how lean production systems differ from traditional production systems along each of the following dimensions: 1. Roles of plant employees 2. Manufacturing cycle times 3. Quality 4....
-
Blue Mountain Hardware is adding a new product line that will require an investment of $ 1,450,000. Managers estimate that this investment will have a 10- year life and generate net cash inflows of $...
-
Compute four ratios that measure Variline's ability to earn profits. The company's comparative income statement follows. The data for 2014 are given as needed. Did the company's operating performance...
-
Suggest a general outline marketing planning strategy for 12 months ahead for Graham Keddie.
-
What part should the sales function play when drawing up a detailed 12 months operational marketing plan for EMA?
-
Explain the differences between marketing strategies and sales strategies.
Study smarter with the SolutionInn App