Grasshopper

algorithmic modeling for Rhino

Network Correlation Visualization (or optimizing distances between nodes)

Hi,

I'm trying to create a nicer version of this plot:

Link

The underlying data is basically a correlation matrix where each relationship between two of the key drivers is assigned a score. The placement of the nodes in relation to one another is then an optimization that minimizes the distance between two nodes the more related they are. Any suggestion for a good way to set this up? I can vaguely picture starting with one node, creating a circle around it with the radius of the score with a second node, then placing that second node on the circle and continuing on, but I imagine there must be a more efficient way to do this.

Thanks!

Views: 2154

Attachments:

Replies to This Discussion

You can approach graph relaxation problems like this with Kangaroo.

Shown here is a set of points with a weight assigned to each pairing, used as the strength of a spring. I've used random weights for this example, but presumably you would have this data in some sort of spreadsheet that you could substitute here.

All the springs are trying to reach a target length of 10 units - simply minimising the distance would result in all the points becoming coincident, but you could alternatively also include a 'ClampLength' goal to keep some minimum distance between all points and then set the target length of the connections to 0.

You'll need the latest Kangaroo to open this definition.

Attachments:

Thank you so much for this - it's really helpful, but I'm a novice and still need some help. I'm attaching both the .gh and the .xlsx file containing the values to read in (I used ghowl).

Here are some of the things I think are issues still:

-In general, I'm a bit confused about the relationship between Length and Strength in the Length(Line) goal (and ClampLength for that matter).

-The data matrix needs to be cut in half (triangle rather than square) so that the lines don't repeat. That is, the first point/category needs to connect to 9 other points, the second then needs to connect to 8 points, the third to 7, and so on. This is what I was trying to accomplish with the Explode Tree and Split List functions in the middle.

-Because of this, I'm losing track of the order of the data, and so I'm not completely sure whether the point/category labels are matching up to the right points/categories.

-A few of the values in the matrix are 0, and I'm concerned that this may interfere with things. My goal is for the higher numbered connections (like E-H) to be closer together, while the lower numbered connections (like D-E which is 0) to be the furthest away.

A couple of other notes:

-Right now, I have an Absolute component in there so that negative connections are treated the same (I'm hoping to color these later).

-I kept the ClampLength goal, though I'm not using it. Given my other requirements, this might be the best way to go, though I'm not sure.

Thanks!

Attachments:

Hi there,

will have a look into it with the provided data. But you could use SpiderWeb and its Eigenvector computation to draw the graph. A not so mathematical introduction can be found:

http://www.sss10.bartlett.ucl.ac.uk/wp-content/uploads/2015/07/SSS1...

including also a few references to mathematical introduction.

BEst

Richard

Hi Richard,

Thank you - from the examples it looks like this does what I need, but I'm having some trouble understanding the basics of SpiderWeb (and how to display the Eigenvectors). Is there more documentation or more thorough tutorials than what is available on the TU Wien website? If you could post a rough example demonstrating how to display a matrix, I would really appreciate it.


All the best,

-Tal

:)

So:

In the attached Image you can see the graph drawn via SpectralGraphDrawing using for the Orange drawing the LaplacianMatrix (doesn't take into account edgewheights). It show that the sampel graph provided has three clusters in the graph.

The blue drawing uses a wehighted Laplacian Matrix (including edge wheights). It is important to understand that heigher edge wheigts mean a stronger connection an will "pull" the nodes closer together -> as suggested in the original post. 

The layout isn't perfect in the sense that it is graphicaly appealing but is good for further analysis e.g: cluster analysis, graph  comparision, minimal cut,... please start with suggested paper above. Further it is not an itterative process but an algorithm with the complexity O(n³) so it is suitable for large graphs even in Grasshopper. I have used it to draw up all the relations of Christoph Alexanders "Pattern Language"

 If you would like to improve layout you can use this as a starting point and than apply some graph relaxation as suggested before.

Please find attached the coresponding GH file, you will need to download SpiderWeb in order to run the code.

If you need any further help please contact me directly, would be very interested:

office[at]planund.com

Enjoy 

Richard

Attachments:

Hi

could you please tell me that how can i write a code that illustrates something like a picture attached with desired lenghts?

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service