Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Dijkstra's Algorithm program must be done in C++ without using any STL (Do NOT use any Standard Template Library) Please read the question carefully and

Dijkstra's Algorithm program must be done in C++ without using any STL (Do NOT use any Standard Template Library)

Please read the question carefully and then answer

image text in transcribedimage text in transcribed

Here is the input file:

20

1 2.5 4.625

2 4.5 5.925

3 7.05 5.475

4 5.45 3.325

5 8.4 2.675

6 9.8 4.475

7 7.3 4.225

8 6.2 1.625

9 3.55 2.325

10 1.85 3.125

11 1.25 5.775

12 3.25 6.975

13 6.6 7.025

14 9.7 5.925

15 10.65 2.525

16 9.4 1.125

17 4 0.975

18 2.05 1.925

19 4.35 4.275

20 6.8 2.925

38

1 11 2.8

12 11 3.7

1 12 4.0

2 1 3.5

2 12 2.7

13 2 3.9

3 13 1.9

19 13 5.3

19 1 2.4

3 19 3.8

7 3 1.5

14 7 4.3

6 14 2.0

7 6 3.6

6 5 3.3

5 7 3.0

20 7 1.8

20 4 1.8

4 7 3.2

4 19 2.4

10 1 2.4

10 11 3.6

9 10 3.0

18 10 1.7

9 18 2.2

17 9 2.4

17 18 2.7

4 9 3.3

8 20 1.7

17 8 3.5

8 4 2.4

5 20 2.0

16 5 2.4

8 16 3.7

15 6 3.4

16 15 2.2

14 13 5.0

13 12 4.6

19 16

Dijkstra's algorithm finds the shortest path from a given node to all other nodes 1) We observe that we can modify this algorithm to stop as soon as a particular node is reached thus producing an algorithm to find the shortest path between a specific pair of points. However, this algorithm may involve the consideration of a number of points which do not lie on the final shortest path. We now consider 2 alternatives We can modify the algorithm to add nodes to the solution based on an A* criterion derived from the Euclidean (straight line) distance from each candidate node to the desired end node. 2) 3)We can attempt to improve our efficiency by modifying Dijkstra's algorithm to start at both the source and destination nodes and to construct two partial solution trees in parallel until one node is in both partial solution trees Your task is to: 1. Code the modified Dijkstra's algorithm to search from the start node out. 2. Code the A variant. 3. Code the proposed improved algorithm Input consists of the following data 1) The number of nodes in the graph. 2) A set of triples containing the node number, its X-coordinate and its Y coordinate one triple for each node in the graph. The number of edges in the graph. A set of triples consisting of two node numbers and a cost- one triple for each edge in the graph. A pair of node numbers representing the start and end nodes between which a path must be found 3) 4) 5)

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions