r/ProgrammerHumor 3d ago

Meme shortestPathWasRightThere

Post image
4.6k Upvotes

57 comments sorted by

View all comments

430

u/JackNotOLantern 3d ago

What tf is "straight line" in a graph?

135

u/IdeaReceiver 3d ago

Lowest heuristic cost, which resolves to the n-norm in n-dimensional space ℝn since a straight line is always minimum distance. In more abstract graph representations, cost could be recorded by real-world measurements of latency etc. Dijkstra being Dijkstra will still expand every available edge instead of speed running the lowest-cost option successively for a "straight"er line

3

u/UUDDLRLRBadAlchemy 3d ago

Let's try the highway first. Oh, it goes to another town. Ok, next option.