Graph theory (shortest path) with Megarachne

Hello everyone again :slight_smile:

This time I invite you to use Megarachne plugin for graph theory in Grasshopper:
https://youtu.be/f8yKkX75oyg

Plugin was created in C# without the usage of external plugins to deal with graphs, which makes it pretty lightweight.

Features for 1.0.0:

  • Graph Parts: Curve To Graph Part, Two Points To Graph Part, Vector To Graph Part
  • Graph: Create Graph, Mesh To Graph, Graph To Report Part, Get Closest Vertex, Get Graph Degree, Get Vertex Degree
  • Algorithms: BFS, Dijkstra, A*

It’s an another open-source project, you can see the source code here: https://github.com/paireks/Megarachne
Also, here is the manual: https://code-structures.com/Megarachne_Manual/Manual%20for%20Megarachne.html
And here is a download link: https://www.food4rhino.com/app/megarachne

I’d like to mention that there is also another new graph plugin called LeafVein created by Dachuan, and it was released few weeks ago: https://www.food4rhino.com/app/leafvein
It’s really cool, and has some unique features for graph theory, I strongly recommend it too!

5 Likes

Hey!
thank you very much for this plug-in!

just a tiny question: I try to get a list of the vertexes I have in a graph with the degree of each one. I see there is this component “Get Vertex Degrees”, but I just don’t get what info I need to provide under “index”
Could you please enlighten it?
Thanks a lot ahead

1 Like

Thank you!

All vertices in graph have its own indices. Index input wants you to input the index of the vertex, for which you’d like to know the degree. So e.g. index = 0 will give you a degree for first vertex.

If you’d like to get degrees for all vertices in graph, I think you will need to get the number of all vertices. To do that I’d use Deconstruct Graph component. You will find there Vertices output, for which I’d take List Length. Then if you will plug it to Series component, you will get the list of numbers like e.g. if there are 5 vertices you will be able to create list {0,1,2,3,4}. So if you will plug this list to “index” input you should get what you want :slight_smile:

If you’d like to find out which vertex has which index, you can try this little component (Get Closest Vertex): Manual for Megarachne
It’s make it a lot easier to find out the indices :slight_smile:

If there will be some problems - let me know, I will prepare some example and post it here!

1 Like

Oh I see, yes I was looking for getting degrees for all vertices in graph.
that was a great explanation!
Thanks a lot!

1 Like