What are the first 3 steps of the given alogrithm. ?This means: visit and expand
ID: 3708137 • Letter: W
Question
What are the first 3 steps of the given alogrithm.
?This means: visit and expand the first 3 nodes starting at 0.
Use the graph above. “0” is the source and “6” is the goal.
Explanation / Answer
The First three steps of algorithm are as follows:
Step 1 :
Right now, you have not visited any city.
So, you are at Source city i.e 0.
Total path cost is 0.
Also, predecessor city is NULL.
Given, C i.e the cities visited so far is also NULL.
Now, Coming to step 2.
Step 2 :
It says that you have to find all the neighbouring cities and make a list in F that are not in C. Since C is empty, So the neighbouring cities that has to be inserted in F are '1' & '2'.
Now, F will have ('1','2'). C will be NULL. Predecessor city P(f) will be ('0','0'). Total Path cost is 0.
Step 3 :
Now, From S i.e '0', we have to visit every city in F i.e ('1','2') and find out the lowest path.
Here, lowest path is 1.1 i.e from '0' city to '1' city.
Then, we have to remove it from F and add it to C.
Now, F will be ('2'). C will be ('1'). Total Path cost will be g(f) will be 1.1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.