A Simple Technique for Creating 3D Graphs from 2D Ones

I happen to be working on the visualization of ‘largish’ graphs (as in network of connected nodes). I started out with 2D layouts but found that after about a 100 nodes the visualization starts to be come ineffective.


The graph layout library I am using – Microsoft Automated Graph Layout (MSAGL) (search MSDN) is effective for laying out 100’s of nodes (I have tested up to 250 but I believe that up to 500 is feasible).

For larger graphs, I decided to take the 2D positioning from MSAGL and ‘space’ that out to 3D. The nodes in the graph are first grouped by some logical grouping and each group is ranked according to the number of connections it has. Based on the ranking, each group is given its own 3D plane. The group with the most connections is put in the middle, flanked by other groups in some order. Each node retains its original 2D, X-Y coordinate from MSAGL but gets the group’s Z coordinate.

The result is quite effective (in my opinion). The 3D layout can be combined with 3D transforms and camera manipulation techniques to give one the feeling of “flying through the data”.

For 3D I am using WPF 3D elements (never thought they would be so useful!). For some of the visualization components I am using 3DTools from CodePlex (http://3dtools.codeplex.com/). Please read and apply the fix for 3D lines mentioned in the Discussions tab, should you want to do the same.

Again F# came in very handy for all the data machinations that were required for the 2D-to-3D processing. Also, FSharpX makes dealing with XAML in F# much more fun.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s