Grasshopper

algorithmic modeling for Rhino

Hi,

Could someone please help me with a subgraph problem.

I have a datatree of integers where each path represents all the connections of the index of the path, e.g.

{0}-3;4

{1}-2

{2}-1;3

{3}-0;2;4

{4}-0;3

{5}-6;7

{6}-5;7

{7}-5;6

Here it can be shown that there are two subgraphs containing 0,1,2,3,4 and 5,6,7. How can I use spiderweb (either using scripting or the components) to give me this result when I have many more vertices??

Thanks,

Sam

Views: 464

Replies to This Discussion

Dear Sam,

best thing to do would be scripting. You can start with the following to load the spiderweb dll's into a vb or c# component 

http://www.gbl.tuwien.ac.at/_docs/GrasshopperScriptum/GrasshopperSc...

Then you would need to construct the graph (which you could do easily outside with the graph from datatree component, parse Vertex List) and start using BFS on a randomly selected vertex. All points that have a distance smaller than infinity can be accessed. So this gives you the first subgraph. Continue to do this as long as not all subgraphs are found.

A second solution would be to compute the eigenvalues and eigenvectors of the matrix representation, but this is still a bit slow since the implementation used in spiderweb needs to compute all eigenvectors...

Hope that helps

Richard

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service