Question: [PYTHON] - GRAPHS ALGORITHMS STACKS SEARCH Instructions: In class, we discussed the Graph data structure. Since the graph is a non-linear structure, there is no
[PYTHON] - GRAPHS ALGORITHMS STACKS SEARCH
![[PYTHON] - GRAPHS ALGORITHMS STACKS SEARCH Instructions: In class, we discussed the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3d6adc7cc4_23766f3d6ad48b2f.jpg)




Instructions: In class, we discussed the Graph data structure. Since the graph is a non-linear structure, there is no unique traversal. Nodes can be found using Breadth-First Search (visit the sibling nodes before visiting the child nodes) and Depth-first search (visit the child nodes before visiting the sibling nodes). We also discussed how a graph implementation can be used to compute the shortest path using Dijkstra's algorithm Based on the code we did in class (provided in the starter code): 1. Create the method dfs(start). This method takes the key of the starting node and performs Depth-first search in an instance of the class Graph. This method must return a list that contains the order in which the nodes where access during the search 2. You must ensure your stack from LAB 10 works properly, as you must use that stack to produce your result (refer to the slides on how the stack helps you to keep track of the nodes during the traversal) 3. Create the method dijkstra(start). This method takes the key of the starting node and runs Dijkstra's algorithm in an instance of the class Graph. The method returns a dictionary with the value of the shortest path from the starting node to every other node reachable from start Notes: To you follow the alphabetical convention for DFS, you have two options: 1) provide the vertices in alphabetical order and add the edges in alphabetical order or 2) provide vertices and edges in random order and sort them in your method. You are free to add method that might help you to achieved the stated goal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
