Worf

Dijkstra's algorithm with VBA

Worf

Well-known Member
Joined
Oct 30, 2011
Messages
4,259
Worf submitted a new Excel article:

Dijkstra's algorithm with VBA - Implements a shortest path algorithm for a 3D problem.

This article shows how to use Dijkstra's algorithm to solve the tridimensional problem stated below.

View attachment 2058

Dijkstra's algorithm - Wikipedia

  • Actually, this is a generic solution where the speed inside the holes is a variable. The original problem is a particular case where this speed goes to infinity.
  • Amelia, Otto and the holes are vertices; imaginary lines...

Read more about this Excel article...
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Nice work!

It appears (from the plot, didn't look at the code) that Amelia flies from hole center to hole center. It doesn't matter if the speed within the hole is infinite, but if not, she (is that her preferred pronoun?) could instead travel a shorter distance flying the chord of the sphere.
 
Hi shg

  • Yes, Amelia is a she…
  • I made some assumptions for this initial version, one of them is that the only allowed chords are the sphere diameters. When the edge connecting sphere A to sphere B goes through sphere C, it is not allowed. I am calling this visibility, A cannot see B.
  • I wanted a graph where not all vertices were interconnected to every other vertex, like in the picture below. Visibility is the criterion to create the edges.
  • The original problem fixes the two different speeds, but I made them variable.


graph.png
 

Forum statistics

Threads
1,223,604
Messages
6,173,315
Members
452,510
Latest member
RCan29

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top