# Jedi Master Dijkstra

## Using ChatGPT Stories as Anchors for Teaching

As I’m teaching a course this term on Algorithms and another on Data Analysis and Machine Learning, I’ve been using ChatGPT to generate some colourful, alternative explanations for some of the topics of both courses and posting them here. (

Part 1, Part 2, Part 3)

The “Dijkstra’s Star Wars Scroll” was the very first idea I had of what to ask #chatgpt when it went live, yes I know, it’s the *obvious* one to start with isn’t it? Anyways, it’s spiralled on from there, I’ll post others I found later. Hopefully you find it useful, and/or informative about the topics, but also about the kind of things this new system *can* do well, and what it *cannot yet* do well.

### Dijkstra’s Algorithm

**prompt:** *Explain Dijkstra’s algorithm, in the style of a Star Wars opening crawl.*

A long time ago, in a galaxy far, far away…

a wise and powerful Jedi master named Dijkstra set out on a quest to find the shortest path between two points in a vast and treacherous universe. Armed with his trusty algorithm, Dijkstra used the power of math and logic to guide him through the unknown, cutting through the chaos and confusion of the galaxy to find the most efficient route.

Through the force of his intellect, Dijkstra was able to create a map of the galaxy, with each star representing a different location and each path between stars representing a possible route. He then used his algorithm to systematically explore each path, carefully weighing the costs and benefits of each one to find the path with the lowest total cost.

As he journeyed across the galaxy, Dijkstra’s algorithm proved to be a powerful tool, allowing him to navigate even the most complex and challenging of environments. Through its use, he was able to find the shortest path to his destination, outsmarting even the most cunning of foes and emerging victorious.

In the end, Dijkstra’s algorithm became a shining example of the power of the Jedi mind, and its principles continue to be used by travellers across the galaxy to this day.

*You can view Dijkstra Star Wars Crawl*.

Is this a good description of the algorithm? I suppose so, I was very impressed that it turned the idea of shortest paths into a map of the galaxy with nodes between stars and routes. *(If only it had actually gotten into the details of Hyperspace routes and the importance of getting your calculations right so you don’t end up inside a star…)* The last few lines seem to stray a bit, but it’s still connected to distances and travel. So, as an initial impression, it did very well.

*I’ll post some other “Chat GPT’s Tales of Algorithms and Complexity” in a later post.*

My lecture for Dijkstra’s algorithm is live now as well and can be seen here.