Hi! I am working on defining a grid of points as a graph, the points act as the nodes and the relationship between these points ( which have to be defined) are to be defined as the edges. I am scripting it in c# on grasshopper using the QuikGraph library, I was wondering if anyone has worked on this topic and if this is the best way to approach this.
Hi @Aishwarya_Arun,
Heteroptera already has a nice set of tools for working with graphs.
There is also networkx if you want to switch over to python.
It only works in rhino 7 with an older version of networkx but much of the core functionality is the same… I’ve gotten a newer version working but only through HOPS.
Well … I have more than 100 C#'s dealing with Graphs. Some are entry level/simple (say up to 300 lines) some not so (say 1-2+K lines). Most are strictly internal. Since I’m in the AEC market sector the scope is to outline trusses/envelopes/etc … and all related parafernalia: island/bridge detection, weak regidity detection/fix, short A* paths, routing in general (Ham/PMST/TSM/etc), clash checks/fixes, interactive on the fly node mods … blah, blah.
So if you need tips … post your code(s) here assuming that (a) are public, (b) you can deal 100% with the Connectivity (VV, VE, EV) part of the story, (c) your goals are more or less well defined.
That said I never work - for more than obvious reasons - with any kind of add-on (other than K2).
The question is too generic. Which type of graph is best suited is up to the problem. In programming, graphs are usually used to organize data. Apart from Arrays, all collections are graphs. A List of T is a (simple) graph. A Dictionary as well. There are tree structures like Binary Trees, Kd Trees etc. A mesh is basically just a graph. But what you need is up to the problem. However, I would always advocate for understanding the topic and implementing it for yourself. I’m rather against using plugins/libraries for simple things. Although understanding recursion is not easy for beginners, it will pay off at the end.