Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| courses:cs211:winter2012:journals:jeanpaul:chapterfour_sectioniv [2012/02/29 01:31] – created mugabej | courses:cs211:winter2012:journals:jeanpaul:chapterfour_sectioniv [2012/02/29 07:28] (current) – mugabej | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| \\ | \\ | ||
| -->Goal of the algorithm: Determine the shortest path from S to every other node in the graph. | -->Goal of the algorithm: Determine the shortest path from S to every other node in the graph. | ||
| + | \\ | ||
| + | ===Designing the algorithm-The Dijkstra algorithm === | ||
| + | |||
| + | \\ | ||
| + | >>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>> | ||
| + | \\ | ||
| + | |||
| + | === Analyzing the algorithm === | ||
| + | |||
| + | * For each u in S, the path P< | ||
| + | * The basic idea of the proof is that Dijkstra' | ||
| + | \\ | ||
| + | \\ | ||
| + | * **Remarks**: | ||
| + | * Dijkstra' | ||
| + | * Dijkstra' | ||
| + | \\ | ||
| + | === Implementations and Running Time === | ||
| + | |||
| + | * There are n-1 iterations of the while loop for a graph with n nodes | ||
| + | * First attempt at selecting the correct node v efficiently: | ||
| + | * Consider each node v ∉ S | ||
| + | * Go through all of the edges between S and v to find the one that satisfies the equation for d' | ||
| + | * For a graph with m edges, the whole operation takes O(mn) time since computing all the minima takes O(m) time.\\ | ||
| + | --> Better implementation: | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>>>>>>>>>>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | >>>>>>>>>> | ||
| + | \\ | ||
| + | This section made a lot more sense especially since I read it after in-class discussion of the algorithm. I give it an 8/10. | ||
| + | |||
