Visualization Techniques for
Trees, Graphs, and Networks
While most of the visualization techniques discussed thus far focus on the display of data values and their attributes, another important application of visualization is the conveying of relational information, e.g., how data items or records are related to each other.
These interrelationships can take many forms:
• connectedness, such as cities connected by roads or computers connected
by networks;
• derived from, as in a sequence of steps or stages;
• shared classification;
• similarities in values;
• similarities in attributes (e.g., spatial, temporal).
In this chapter we will examine a number of techniques that have been developed for visualizing relational information.
8.1 Displaying Hierarchical Structures
8.1.1 Space-Filling Methods
Pseudocode for this process is given in Figure 8.1, and an example is shown in Figure 8.2.
Start: Main Program
Width = width of rectangle
Height = height of rectangle
Node = root node of the tree
Origin = position of rectangle, e.g., [0,0]
Orientation = direction of cuts, alternating between horizontal and vertical
Treemap(Node, Orientation, Origin, Width, Height)
End: Main Program
Treemap(node n, orientation o, position orig, hsize w, vsize h)
if n is a terminal node (i.e., it has no children)
draw_rectangle(orig, w, h)
return
for each child of n (child_i), get number of terminal nodes in subtree
sum up number of terminal nodes
compute percentage of terminal nodes in n from each subtree (percent_i)
if orientation is horizontal
for each subtree
compute offset of origin based on origin and width (offset_i)
treemap(child_i, vertical, orig + offset_i, w * percent_i, h)
else
for each subtree
compute offset of origin based on origin and height (offset_i)
treemap(child_i, horizontal, orig + offset_i, w, h * percent_i)
End: Treemap
Figure 8.1. Pseudocode for drawing a hierarchy using a treemap.
Figure 8.2. A sample hierarchy and the corresponding treemap display.
As mentioned, many variants on treemaps have been proposed and developed since they were introduced, including squarified treemaps [40] (to reduce the occurrence of long, thin rectangles) and nested treemaps [176] (to emphasize the hierarchical structure).
The methods described above are structured using horizontal and vertical divisions to convey the hierarchy.
A number of other approaches are possible, however, such as those that divide space radially.
Start: Main Program
Start = start angle for a node (initially 0)
End = end angle for a node (initially 360)
Origin = position of center of sunburst, e.g., [0,0]
Level = current level of hierarchy (initially 0)
Width = thickness of each radial band - based on max depth and display size
Sunburst(Node, Start, End, Level)
End: Main Program
Pseudocode for drawing a hierarchy using a sunburst display
Sunburst(node n, angle st, angle en, level l)
if n is a terminal node (i.e., it has no children)
draw_radial_section(Origin, st, en, l * Width, (l+1) * Width)
return
for each child of n (child_i), get number of terminal nodes in subtree
sum up number of terminal nodes
compute percentage of terminal nodes in n from each subtree (percent_i)
for each subtree
compute start/end angle based on size of subtrees, order, and angle range
Sunburst(child_i, st_i, en_i, l+1)
End: Sunburst
Figure 8.3. Pseudocode for drawing a hierarchy using a sunburst display.
Figure 8.4. A sample hierarchy and the corresponding sunburst display.
8.1.2 Non–Space-Filling Methods
Aesthetics, however, often have significant impact on the interpretability of a tree or graph drawing yet often result in conflicting guidelines.
Some typical aesthetic rules include:
• minimize line crossings
• maintain a pleasing aspect ratio
• minimize the total area of the drawing
• minimize the total length of the edges
• minimize the number of bends in the edges
• minimize the number of distinct angles or curvatures used
• strive for a symmetric structure
For trees, especially balanced ones, it is relatively easy to design algorithms that adhere to many, if not most, of these guidelines.
For example, a simple tree drawing procedure is given below (sample output is shown in Figure 8.5):
the depth of the tree.
2. For each level of the tree, determine how many nodes
need to be drawn.
3. Divide each slice into equal-sized rectangles based on the number of
nodes at that level.
4. Draw each node in the center of its corresponding rectangle.
5. Draw a link between the center-bottom of each node to the center-top
of its child node(s).
Figure 8.5. An example of visualizing hierarchies with a simple node-link diagram, using equal spacing per level.
Many enhancements can be made to this rather basic algorithm in order to improve space utilization and move child nodes closer to their parents.
Some of these include:
• Rather than using even spacing and centering, divide each level based on the number of terminal nodes belonging to each subtree.
• Spread terminal nodes evenly across the drawing area and center parent nodes above them.
• Add some buffer space between adjacent non sibling nodes to emphasize relationships.
• If possible, reorder the subtrees of a node to achieve more symmetry and balance.
• Position the root node in the center of the display and lay out child nodes radially, rather than vertically.
Figure 8.6. An example of a hierarchy displayed with a cone tree [293]. (Image c 1991 Association of Computing Machinery. Reprinted by permission, courtesy of PARC, Inc.)
8.2 Displaying Arbitrary Graphs/Networks
8.2.1 Node-Link Graphs
Figure 8.7. An example of a force-directed graph. The graph, showing relationships between
countries of Europe, was generated with aiSee: http://www.aisee.com.
If rij is the strength of the repulsion between nodes i and j, the x-component of the repulsion force can be computed as
• A face is a partition of the plane isolated by a set of connected vertices.
• A neighbor set is a counter-clockwise listing of the vertices incident to a particular vertex.
• A planar embedding is a class of planar graph drawings with the same neighbor sets for each vertex. A planar graph can have an exponential number of such embeddings.
• A cutvertex is any node that causes the graph to be disconnected if it is removed.
• A biconnected graph is one without a cutvertex.
• A block is a maximally biconnected subgraph of a graph.
• A separating pair means two vertices whose removal causes a biconnected graph to become disconnected.
• A triconnected graph is one without a separating pair. A planar triconnected graph has a unique embedding.
The general reasoning of the algorithm is as follows.
If a graph is nonplanar, we can make it planar using the following strategy:
1. Determine the largest planar subgraph of the graph.
2. For the remaining vertices, place each within a face that minimizes the number of edge crossings.
3. For each edge crossing, break the edges into two parts each, and connect the broken ends to a new dummy vertex.
8.2.2 Matrix Representations for Graphs
An alternate visual representation of a graph is via an adjacency matrix, which is an N by N grid (where N is the number of nodes), where position (i, j) represents the existence (or not) of a link between nodes i and j.
This may be a binary matrix, or the value might represent the strength or weight of the link between the two nodes.
This method overcomes one of the biggest problems with node-link diagrams, namely that of crossing edges, though it doesn’t scale well to graphs with large numbers (thousands) of nodes. Bertin [26] was one of the first researchers to investigate the power of this representation, using different reordering strategies to organize the rows and columns to reveal structures within the graph. The importance of the reordering is apparent in Figure 8.10, where each matrix represents the same eight-node graph.
The two four-node cliques are clearly apparent in the second display.
8.3 Other Issues(Interpretability)
8.3.1 Labeling
8.3.1 Labeling (cont.….)
8.3.1 Labeling(cont..)
At the other extreme, if there are a large number of distinct labels that need to be shown, or the labels themselves are quite long, it becomes readily apparent that simultaneous display of all labels will be ineffective. Several strategies have been developed to cope with this problem. A common solution is to only show labels in a small region of the graph, for example, within a certain radius of the cursor position. If the density of the display is too high, a distortion of the visualization may be required (see the next subsection) to provide more screen space for that section of the graph. An alternate to distortion that sometimes works is to rotate the graph to reduce the overlap between labels (see Figure 8.11). Another interesting solution
proposed in [37] is to only show a random subset of the labels for a short period of time, and then switch to showing the labels for a different subset. The idea behind this approach is that the viewer’s short-term memory will enable recall of a larger number of labels as compared to a static display, especially if this memory is refreshed on a regular basis.
8.3.2 Interactions
Interactions with the virtual camera:
8.3.2 Interactions (cont….)
Interactions with the graph elements:
Interactions with the graph structure.
8.3.2 Interactions (cont….)
A second class of interactions associated with the graph structure comprises the so-called focus+context techniques, where a selected subset of the structure (focus) is presented in detail, while the rest of the structure is shown in low detail to help the viewer maintain context.
These techniques are related to panning and zooming, without the loss of context.
The most popular of these distortion techniques are the many variants on a fisheye lens, where the parts of the visualization falling within a focal region are enlarged using a nonlinear scaling, while the parts outside the focal region are proportionally shrunk to maintain their presence in the display.
This distortion can be performed either in screen space (i.e., based on pixels) or I structure space (i.e., based on the components of the graph).
It is the latter case that is more interesting in graph visualization, as we might, for example, enlarge one branch of a tree while reducing the size of other branches, or enlarge all links within three connections of a particular node in order to view its neighborhood in more detail.
8.3.2 Interactions (cont….)
An example of structure space distortion can be seen in Figure 8.12, where the blue subtree of Figure 8.11 has been angularly enlarged to enable easier exploration and interactive selection.