# Dijkstra's algo, tabular vs “just select the shortest path”?

So my lecture notes gave a "tabular" Dijkstra's algorithm which first constructs a distance matrix that contains the distances from every node $i$ to node $j$.

Then it proceeds:

List the node names in order (the example uses the alphabet). Take start node and write 0 beneath it, understrike it to signify that it's the final value, also list the distances to all the other nodes from the start node.

Move one row below and consider node B, write to it the shortest path (which coming from $A$ is 1). Then list all the distances to the other nodes as well, taking in account the distance that one came from $A$ to $B$. Again select the smallest path and understrike it for $B$. Continue ...

The final result in this case comes out to look like:

But particularly, since watching the def. for Dijkstra's algo in another site (https://brilliant.org/wiki/dijkstras-short-path-finder/), why doesn't one just take the shortest path directly? Why tabulate and construct distance matrices? Shouldn't it be clear that simply taking the shortest paths is both 1) most efficient and 2) feasible, since one knows all the distances.

A greedy algorithm would suggest to simply follow the strings of 1's to get from $A$ to $E$, however, we can see that the shortest path is not along the 1's, but the longest edge here. One could imagine extending this example, to where we have $n$ sides of length 1, and one side of length $n-1$.
As can be seen, simply taking the shortest paths each time (from one node to the next) results in not always getting the true shortest path. You could instead say "lets find the set of distances of all paths from $A$ to $E$ and then take the shortest one", but then there is the question of how to do this efficiently. The answer to that is Dijkstra.