designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Shortest Path Generator

April 30, 2012 | Algorithms
#computational-geometry #grasshopper #vbnet

This is the continuation of my scripting experiment within Grasshopper. Like the minimum spanning tree algorithm, this is also a famous problem of computational geometry; the shortest path problem. I’m now coding faster and understanding the namespace more easily in Grasshopper. This time, the challenge was implementing Dijkstra’s algorithm for the Shortest Path Generator. Again, it’s a quite powerful algorithm, I even plan to use it in my current project. Although there is a faster alternative, Shortest Walk-in Food4Rhino and it was already implemented as a native Grasshopper component in later versions, it was a good challenge in 2012. Like the minimum spanning tree algorithm, this script may contain bugs and miscalculations. For example, in 3D points, it sometimes seemed a little weird to me.

Shortest Path Generator animation

This Grasshopper definition calculates the shortest path on a given line network and two points. It utilizes on Vb.net scripting component I wrote. Thus, no add-ons are necessary for it to work. This makes the code written in 2012 still usable in 2021. When you run the code, make sure that the startp and endp inputs are fed. Then, the script calculates the shortest path between the closest nodes from these points. It is a little messy code but I tried to comment on important lines. It is a kind of study-solve-and-forget project since I don’t remember the exact algorithm now. However, the recent project we finished utilizes Space Syntax graphs and I saw that most of the Space Syntax metrics are based on this and similar network calculations.

Shortest Path Generator Grasshopper definition
Shortest Path Generator computational-geometry, grasshopper
Grasshopper definition (GH)Download

Cite this post

Yazar, T. (2012, April 30). Shortest Path Generator. designcoding. Retrieved August 28, 2026, from https://www.designcoding.net/shortest-path-generator/

Related Posts

Minimum Spanning Tree

April 26, 2012

This is the updated version of my MST code from 2012. After over a hundred hours of Rhinocommon and Grasshopper SDK studies, and lots of dead ends, I was finally able to calculate the minimum spanning tree of any given curve network in Grasshopper. Problems like these are interesting to me because of their clear logic and diverse areas of applications in design. I tried to simulate Dijkstra’s, Kruskal’s, and Prim’s algorithms, but no chance. There are similar solutions such…

Tattoo Design

April 27, 2023

Here is a tattoo design I am currently developing by using Grasshopper. 11 years ago, I developed a Grasshopper definition that approximates Julia Sets here. One of the experimental outputs of that definition looks suitable for a tattoo design. It is a beautiful fractal shape. But I am not perfectly sure about its suitability for a tattoo. Here it is: This was generated by the function z2+c and the parameters were: 0.3+0.49i with 25 iterations. I experimented a bit more…

Fractal Trees

April 11, 2015

Based on this post, the problem of modeling tree-like fractal shapes is still a good question for the early years of computational design education. Last time, I used Rhino’s macro to study these fractal trees in an “impossibly” limited interface. But this time I used a VB.NET script. Here is the code inside of the VB.net component: Here are the inputs. x is the number of iterations. The Crv input is a line needed for the first iteration. t represents how…

Camera Animation

April 28, 2014

Here is the simple Grasshopper definition that activates Rhinoceros’ camera by given parameters. Camera position is determined by the “point-oriented” method here. This means that you have to have a target point for the camera first. In fact, I was trying to find a suitable command for getting the actual camera position of the Rhinoceros but I think it is impossible (for now). I couldn’t track the camera object by its ID number also. There are some Grasshopper components that deal with…

Regenerating Random Numbers

January 2, 2013

Just a quick tip as I thought might be useful in some cases. Generating random numbers in architectural scripting is not a too catchy thing for designers. It is for sure, we want every parameter to be under our control (as if it were possible!). I was thinking about that in Grasshopper. A dataflow graph such as in Grasshopper regenerates whenever necessary (a change on an input value “fires” every connected component), therefore random number component requires your action (for…

  • Chapters

    • Algorithms
    • Discourses
    • Fabrications
    • Studios
  • Explore

    • All Keywords
    • Table of Contents
    • Monthly Archive
    • #rhino-python
    • #polyhedra
    • #parametric-surface
    • #robot
    • #tessellation
    • #boolean
    • #kuka-prc
    • #dome
    • #design-object
    • #image-sampler
    • #growth
    • #terrain
    • #sandblasting
    • #stone
    • #parametric-curve
    • #animation
    • #cycloid
    • #art
    • #aperiodic
    • #tiling
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement