# Tree and graphs

Topics: Graph theory, Korn shell, Tree Pages: 14 (815 words) Published: February 24, 2014
Trees and Graphs
Pat Hanrahan

Tree Drawing

Page 1

Why Trees?
Hierarchies
File systems and web sites
Organization charts
Categorical classifications
Similiarity and clustering
Branching processes
Genealogy and lineages
Phylogenetic trees
Decision processes
Indices or search trees
Decision trees
Tournaments

Two Major Visual Representations
Connection: Node / Link Diagrams

Containment / Enclosure
F6
G6
H6
J36
U8
B10

C30
L7 M7

V12
O4 P4 Q4 R4 S4 T4
W8

Page 2

[Furbringer]

C. Elegans Cell Lineage

[Sulston]

Page 3

Page 4

Page 5

Page 6

Classic Tree Drawing
Preorder or inorder traversal

Depth-InOrder Traversal
0
1
2
3
4
5
6
7

0 1 2 3 4 5 6 7 8 9 10 11 13 14 15

Similarly for pre-order, postorder
Note: width = n-1

Page 7

Aesthetic Criteria
1.

Nodes at the same levels should be aligned

2.

Maintain the relative ordering of left and
right subtrees

3.

Parent should be centered over the children

4.

A tree and its mirror image should be
drawn as reflections of each other

5.

A subtree should be drawn the same way
regardless of where it occurs in the tree

Rheingold-Tilford Algorithm

E. Rheingold, J. Tilford, Tidier drawing of trees, IEEE Trans. Software Engineering, SE-7(2), pp. 223-228. 1981

Page 8

Rheingold-Tilford Algorithm

Left contour
Left threads
Right contour
Right threads

E. Rheingold, J. Tilford, Tidier drawing of trees, IEEE Trans. Software Engineering, SE-7(2), pp. 223-228. 1981

Rheingold-Tilford Algorithm

Separation = 2

E. Rheingold, J. Tilford, Tidier drawing of trees, IEEE Trans. Software Engineering, SE-7(2), pp. 223-228. 1981

Page 9

Rheingold-Tilford Algorithm
Translate by (sep+1)/2

E. Rheingold, J. Tilford, Tidier drawing of trees, IEEE Trans. Software Engineering, SE-7(2), pp. 223-228. 1981

Rheingold-Tilford Algorithm

T = min(h(TL), h(TR)

E. Rheingold, J. Tilford, Tidier drawing of trees, IEEE Trans. Software Engineering, SE-7(2), pp. 223-228. 1981

Page 10

Rheingold-Tilford Algorithm
Total running time: Count

O( n – h(T))

E. Rheingold, J. Tilford, Tidier drawing of trees, IEEE Trans. Software Engineering, SE-7(2), pp. 223-228. 1981

Focus+Context: DOI Tree

http://davenation.com/doitree/doitree-avi-2002.htm

Page 11

Radial Layouts

Bounded wedge

Aspect Ratio
Hierarchies are typically wide and shallow
http://cgm.cs.mcgill.ca/~luc/trees.html

Strategies:
Scrolling
Filtering, collapsing, expanding
Grouping and aggregating
More space: Cone Tree, Hyperbolic
Browser
Focus + context

Page 12

Cone Trees

Cone Tree, Robertson, Card, Mackinlay, 1991

Hyperbolic Trees

Demo on InXight

Page 13

Nested/Inclusion Trees

A
B
C

E
D

G
F

H

I

(A (B (C D) (E (G (H I)))))

Tree Maps [Schneiderman]

http://netscan.research.microsoft.com/treemap/

Page 14

Graph Drawing

Why Graphs?
Relational databases with keys
Complex data structures
Social networks
Citation networks
Link analysis
Computer networks
World wide web
Document collections
Metabolic pathways

Page 15

Aesthetic Criteria
Minimize edge crossings
Minimize area
Total edge length
Maximum edge length
Uniform edge length
Total bends
Maximum bends
Angular bends
Aspect ratio
Symmetry
G. Di Battista, P. Eades, R. Tamassia, I. G. Tollis,
Graph Drawing, 1999

Algorithms
Planar drawings
Layered
Force-directed

Page 16

Layered Drawing of Directed Graphs
Sugiyama et al. 1981
Dot, Gamsden et al. 1993
1.

Layer assignment

2.

Reduce edge crossings between layers

3.

Position vertices horizontally

Additionally,
4.

Cycle removal

5.

Route edges (fit splines)

shells.dot
Thompson -> Mashey;
Thompson -> Bourne;
Thompson -> csh;
csh -> tcsh;
Bourne -> ksh;
Bourne -> esh;
Bourne -> vsh;
Bourne -> "System-V";
Bourne -> v9sh;
v9sh -> rc;
Bourne -> Bash;...

Please join StudyMode to read the full document