viksoe.dk

TreeMap Graphs

TreeMap Graphs


This article was submitted .


Graphs are fun. This is a sample that let you experiment with different TreeMap algorithms.
TreeMapping is a graph layout technique that is particular well suited for displaying hierarchies, such as a tree structure. Each node in the graph gets a surface area proportionally to the size it represents in the logical data tree. The algorithms produce a fairly compact layout that even includes the child nodes of the hierarchy. The end result presents itself as a much improved overview of how a complex structure is segmented.
TreeMap algorithms follow the traditional Divide and Conquer approach. Usually they operate on each tree depth as a separate step and attempt to distribute the nodes equally on the area given, before descending into the next tree level.

While TreeMaps are very stunning when they display a large tree structure like a file-system, and even more so one that loads slowly so the graph gradually progresses into its final shape, this sample is not particular suited for displaying a file-system folder hierarchy. It will need a bit of optimization to handle very large trees. Still it should be easy to modify to fit a custom tree node structure. And yet, displaying your file-system is exactly what this sample does. It runs quite decently on a dual-core machine except when you try to scan the entire drive structure of your PC.

There are several published TreeMapping algorithms:

  • Slice & Dice
  • Strip
  • Squarified
  • Ordered Pivot
The original algorithm, Slice & Dice, was developed for a file-system display application and tended to produce long skinny rectangles. But eventually, several new algorithms were invented to generate square rectangles and ease the jump in aspect ratio between adjoined nodes, resulting in a much more visually pleasing output.
The algorithms are generally categorized after how well they tile and order the nodes, generate squared rectangles with low aspect ratios and the stability of graph when nodes are added progressively over time. This sample offers 3 algorithms to play with: Slice & Dice, Strip and Squarified treemaps.

Source Code Dependencies

Microsoft Visual C++ 6.0
Microsoft WTL 7.5 Library
Microsoft ATL Library

Download Files

DownloadSample Application (65 Kb)
Source Code (128 Kb)

To the top