3 ms·
Dijkstra's algorithm ( http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm ) It is a really elegant algorit
by blubbi2 13y ago
Dijkstra's algorithm ( http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm )
It is a really elegant algorithm and addresses a real-world problem. A teacher of mine once showed us the basic idea behind it:
He connected various bits of wood (=nodes) using strings (=edges). Then he picked up one bit of wood (=starting node) and slowly moved it upwards. Every time when a new node moves, it is an indication that the shortest path between the start node and the new node has been found. He did this until he reached the desired end node.
The shortest path between the two nodes is in the end clearly visible, because the path between two nodes A and B that are part of the path between the start and end node is always the shortest path possible.
It is really simple if you think of it as a physical model, unfortunately I could not find a picture of it online :(
- jogzden 13y agoThe gif on wikipedia (http://i.imgur.com/ZQMaGhj.gif http://i.imgur.com/ZQMaGhj.gif) was actually a very good example. Thanks! :D