Here's the question you clicked on:
RaphaelFilgueiras
some one can explain me how Dijkstra algorithm works?
The Djikstra algorithm finds the shortest path from one node to all the others producing a shortest path tree. 1. You start from a random node (node A in Your picture). Node A has a value of 0 because it's the starting node. 2. The path from A -> B = 2 so You assign the value 2 to node B. 3. The path from A - > G = 6 so You assign the value 6 to Node G. Since node A has no more neighbor nodes (there are no more nodes directly connected to node A) You are done with it. Your next node is the node with the smallest value (which is B with a value of 2). 4. Here we have B -> C = 7 so node C gets 7 + the value of B which is 2. So C = 9. B - > E = 2. So E gets the value 2 + 2 = 4. That's it for node B. The next one is E which has the smallest value (4). 5. The connections with E are E->F = 2 (F gets a 4 + 2) and E->G = 5. Now here is the important bit; G already has a value (it's 6). But since 5 < 6, we delete the value 6 and instead write the five. Thats because the path A->B->E->G = 5 is smaller than A -> G = 6. So G gets a new value: 5. This process is repeated for every node. Here is a animation that could help You visualize the algorithm: http://upload.wikimedia.org/wikipedia/commons/4/45/Dijksta_Anim.gif