This preview shows page 1. Sign up to view the full content.
Unformatted text preview: edure as shown above. And, you can see the above procedure “in action” by trying the demo available at http://www.dgp.toronto.edu/people/JamesStewart/270/9798s/Laffra/DijkstraApplet.html (you need to have Java installed on your computer to be able to run this demo) 28 And, now, we ask the question that we always ask after we devise an algorithm – how good is this algorithm? How long would it take?
We assume that the graph on which we run the algorithm has N vertices and that the maximum number of edges out of any vertex in the graph is K. Note: The number of edges out of a vertex is called the degree of that vertex. So, K is the maximum degree of all vertices in the graph. Since there can be no more than N‐1 edges out of a vertex, K cannot exceed N‐1. In each iteration of our algorithm, we examines some candidate paths. The set of candidate paths we examine in a given iteration are precisely those resulting from considering the edges out of the red node we have added in the previous iteration. At most we would have K such candidate paths (per iteration). Our algorithm executes exactly N‐1 iterations (recall that each iteration turns one of the vertices from blue to red, and since we started with N‐1 blue vertices, we will execute exactly N‐1 iterations). So, the total number of paths we will evaluate will be no more than K*(N‐1...
View Full Document
This note was uploaded on 02/10/2014 for the course CS 109 taught by Professor Azerbestavros during the Spring '13 term at BU.
- Spring '13