cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Translate the entire conversation x

Mathcad Community Challenge September 2025: Dijkstra's algorithm-Inspired Programming Challenge

DaveMartin
16-Pearl

Mathcad Community Challenge September 2025: Dijkstra's algorithm-Inspired Programming Challenge

This month’s challenge is a programming challenge inspired by Dijkstra’s algorithm, which finds the shortest path from a single source to all the other nodes in a network, based on weighting.

In this scenario, we will use points in a 2D plot, where the weighting is the distance between the points.

Djikstra Initial.png

 

Challenge 1: Known Points

For the provided points, write a program to calculate the shortest path from the first node (5,5) to all other nodes, always choosing the shortest path from the current node.

Feel free to use Mathcad's random number generator functions to make your own points instead. You can also start from a different point of your choosing if you so desire.

 

Challenge 2: Graphing

Create a Chart Component or XY Plot that graphs this path.

 

Challenge 3: Advanced Inputs

Incorporate advanced input controls to allow the user to change quantities such as the number of points or generate new points / path.

 

Challenge 4: 3D

Can you write a program that performs the same calculation, but for points in 3D instead of 2D?

 

A Mathcad Prime 10 worksheet that was used to generate the above image has been attached to this challenge.

 

Find the Mathcad Community Challenge Guidelines here! Have fun!

 

 

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com
41 REPLIES 41
Werner_E
25-Diamond I
(To:ppal)


@ppal wrote:

https://www.wired.com/story/new-method-is-the-fastest-way-to-find-the-best-routes/


Interesting paper about an algorithm which claims to beat Dijkstra - unfortunately the algorithm isn't laid out in detail.

 

But...

 

1) Where is your Mathcad or Prime sheet demonstrating the algorithm? 😈

 

2) While the title  here misleading says "Dijkstra", the actual challenge has nothing to do with the Dijkstra algorithm at all. This challenge is about the Travelling Salesman problem which can't be solve using Dijkstra. Dijkstra solves a completely different problem though both deal with "paths of minimal length/costs".
In the Travelling Salesman (the problem this September challenge is all about) a round trip is looked for (if we also should return to the starting point is not specified clearly) and its assumed that every two points are connected. 

Dijkstra on the other hand is used to solve a problem similar to what a route planner does - finding the shortest route between two given points and not every point is reachable by every other (otherwise the direct connection would always be the optimal solution).

 

Very interesting, @ppal! Thanks for posting.

 

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com

Sorry for the delays, here's the solution blog!

https://www.ptc.com/en/blogs/cad/community-challenge-dijkstra-algorithm

 

...There's something very different about one than the others, so... that's why there were delays.

 

(I'll... distribute badges out shortly.)

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.

Badges out (and in a new PTC brand colour-compliant maroon), so I'll be unfloating this thread.

 

Or sinking it... to foreshadow the next challenge...

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.

I like it!

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com
Werner_E
25-Diamond I
(To:DJNewman)


@DJNewman wrote:

Badges out (and in a new PTC brand colour-compliant maroon), so I'll be unfloating this thread.


Reminds if of one of Bugs Bunny’s favorite phrases - “Whatta maroon”.

Maybe you should officially use a different name for this type of brown 😉

 

StuartBruff
23-Emerald IV
(To:DJNewman)

For those who doubt the existence of The Committee that's out to stop me doing Mathcad-related stuff, I've just tried to follow that link and ...

 

StuartBruff_0-1761769284680.png

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)


@StuartBruff wrote:

For those who doubt the existence of The Committee that's out to stop me doing Mathcad-related stuff, I've just tried to follow that link and ...

 

 

 

Stuart


I guess if we would use "www-cf" instead of just "www" we all would be blocked?

As far as I can see "-cf" is not part of the link posted by @DJNewman  which is https://www.ptc.com/en/blogs/cad/community-challenge-dijkstra-algorithm

So where does this "-cf" stem from? Once again, it was probably those nasty little goblins who want to prevent you from doing anything sensible...

StuartBruff
23-Emerald IV
(To:Werner_E)

I think the cf is related to whatever is doing or reporting the blocking.  The string shown in my Address bar is:

 

https://www.ptc .com/en/blogs/cad/community-challenge-dijkstra-algorithm?_gl=1*1wt654h*_gcl_au*NjY0NzM1ODY4LjE3NTYyMDk5NzQuMTQwNDcyMjE3Ny4xNzYxNjAzMjE3LjE3NjE2MDMyODM.*_ga*MTE4OTU3MzgyNi4xNzU2MjA5OTc0*_ga_7NMP2MSYPM*czE3NjE3NjkwMjQkbzMyMCRnMSR0MTc2MTc3OTUwMCRqNjAkbDAkaDA.

 

(space added after "ptc" to stop the whole string being potentially abbreviated by the host)

 

However, even deleting everything from the ? onwards doesn't improve matters ... for me.

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

That's strange, indeed. When I copy your complete string and delete the space after "ptc" I am sent to the correct page.

 

Have you tried different browser?

Does this shortened URL work for you: https://shorturl.at/0xia0

 

Another idea is that the redirection to www-cf might indicate a problem with/of Cloudflare.
Maybe dependent on where you come from (as it works OK for me). You might test using a VPN if possible (or use the free one in Opera).

 

StuartBruff
23-Emerald IV
(To:Werner_E)

The shortcut didn't work in Chrome, either.

 

However, trying a different browser did.  Duck Duck Go worked.   

 

Thanks,

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

That's odd! At least it works with DDG for you.

My default browser is FF, and I just tried it with Chrome too—no problem either.

Announcements

Top Tags