0% found this document useful (0 votes)
26 views119 pages

Lecture14 TreesAndGraphs

The document discusses different techniques for visualizing tree and graph data structures. It begins by defining key concepts like trees, graphs, nodes, edges, and different types of trees. It then covers different approaches for visually representing trees and graphs, including node-link diagrams, tree maps, radial layouts, and containment layouts. Specific algorithms are described for creating node-link and tree map visualizations in a structured, recursive manner. Design considerations like layout dimensionality, node placement, and edge representation are also covered. Overall the document provides an overview of techniques for visually encoding tree and graph structures.

Uploaded by

ganesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
26 views119 pages

Lecture14 TreesAndGraphs

The document discusses different techniques for visualizing tree and graph data structures. It begins by defining key concepts like trees, graphs, nodes, edges, and different types of trees. It then covers different approaches for visually representing trees and graphs, including node-link diagrams, tree maps, radial layouts, and containment layouts. Specific algorithms are described for creating node-link and tree map visualizations in a structured, recursive manner. Design considerations like layout dimensionality, node placement, and edge representation are also covered. Overall the document provides an overview of techniques for visually encoding tree and graph structures.

Uploaded by

ganesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 119

VISUALIZING TREES AND

GRAPHS

Petra Isenberg
RECAP
you have learned about
• simple plots
• multi-attribute data visualization
DATA AND ITS
STRUCTURE
STRUCTURED DATA UNSTRUCTURED DATA
STRUCTURED DATA
• there are relationships between the data items
• you can use a graph representation

edge node
http://www.curehunter.com

visual dictionary of drugs,


diseases and therapies
https://dhs.stanford.edu/spatial-
humanities/visualizing-databases/
http://truth-and-beauty.net/projects/muesli-
ingredient-network
http://www.cabreastcancer.org/causes/#
GRAPHS
Graphs
• Describe relations among data items
• Using nodes and edges

edge node
DEFINITIONS
a tree is a connected graph with no cycles
DEFINITIONS
an undirected tree is an undirected graph in which any two
vertices are connected by exactly one simple path (= a path
with no repeated vertices)
DEFINITIONS
a directed tree is a digraph
(directed graph) whose
underlying graph is a tree
– a directed tree consists of a
number of nodes and parent-
child relationships
– every node has just one parent
and any number of children
– directed trees are the most
common form in computer
science
The most important nonlinear
TREES data structure in computer
science (Donald Knuth, 1997)

• Directed acyclic graph /


connected graph with n-1 edges
• Nodes have one parent & 0-N children

edge
node
DEFINITIONS
• the number of children of a node is called its
degree
• leaf nodes are nodes without children
DEFINITIONS
• a rooted tree is a directed tree with a
distinguished vertex r, called the root, such that
for every other vertex v there is directed path
from r to v. The root node is the only node with
no parent
• any node may act as a root in undirected trees
DEFINITIONS
the connection between parent and child nodes is
called an edge
DEFINITIONS
an ordered tree is a rooted tree in which the
children of each vertex are assigned a fixed
ordering.
EXAMPLES OF TREES
HIERARCHIES
HIERARCHIES
org charts aren’t
always trees, though

http://www.bonkersworld.
net/organizational-charts/
DECISION PROCESS
BRANCHING PROCESSES

Think about it: is a family tree really a tree?


TREE REPRESENTATION
TECHNIQUES
CATEGORIZATIONS OF LAYOUTS
• many possible
• here we follow the categorization on treevis.net:
– Dimensionality of the layout
– Representation type
– Alignment of nodes in space
2D, AXIS-PARALLEL, EXPLICIT
EDGES
NODE-LINK
NODE-LINK ALGORITHM
12

7 11

2 6 8 10

1 4 5 9

0 3

THE LAYOUT WE WANT – HOW DO WE GET THERE?


NODE-LINK ALGORITHM
SIMPLE APPROACH

1) COUNT THE LEAVES 12

2) PLACE THE ROOT


7 11

2 6 8 10

1 4 5 9

0 3
NODE-LINK ALGORITHM
SIMPLE APPROACH

1) COUNT THE LEAVES 12

2) PLACE THE ROOT


3) RECURSIVELY DIVIDE 7 11

12
2 6 8 10

1 4 5 9

0 3
NODE-LINK ALGORITHM
SIMPLE APPROACH

1) COUNT THE LEAVES 12

2) PLACE THE ROOT


3) RECURSIVELY DIVIDE 7 11

12
2 6 8 10

7 11

1 4 5 9
2 6 8 10

1 4 5 9
0 3

0 3
PROS/CONS
• nodes at the same distance from the root are
horizontally aligned
• positive: simple to understand, clear symmetries
• negative: needs large area, often bad aspect
ratio (much wider than tall)
• what can we vary in this representation?
– marks that depict nodes
– visual variables used on marks to depict
metadata
– type of links
– visual variables used on marks that depict
the links
– placement of nodes
vary edges

node placement

marks

Images created with yEd: http://www.yworks.com


SPECIFIC ALGORITHMS
• usually described recursively
• well known: Reingold-Tilford algorithm
• lots of research in this direction:
– Wetherell and Shannon 1978, Tidy Drawings of Trees
– Reingold and Tilford 1981, Tidier Drawing of Trees
– Walker 1990, A Node-positioning Algorithm for General
Trees
– Buchheim et al 2002, Improving Walker’s Algorithm to
Run in Linear Time
AESTHETICS
aesthetics of node-link tree algorithms describe
properties that improve the perception of the
data that is being layed out

• area: match area of your layout to the size of the display


and data
• aspect ratio: usually optimal if close to 1
• subtree separation: try not to overlap subtrees
• root-leaf distance: minimize distance from root to leaves
• edge lengths: minimize total, average, maximum, edge
lengths & try to make edge lengths uniform
• angular resolution: increase angles formed by edges
• symmetry: symmetric layouts usually considered pleasing
HV DRAWING
• for binary trees
• straight line grid drawing
– every child of a vertex u, is either
horizontally aligned with and to the
right of u, or vertically aligned with
and below u
– the bounding rectangles (smallest
rectangles with horizontal and
vertical sides covering the
drawings) of the subtrees of u do
not intersect
HV DRAWING STRATEGY
• divide: recursively construct hv-drawings for left
and right subtrees
• conquer: perform either a horizontal combination
or a vertical combination

horizontal combination vertical combination

Resource: Battista et al. Graph Drawing


As an exercise,
fill in the rest by yourself
LAYOUT DIMENSIONALITY:
2D – THREAD ARCS
• email visualization

Thread Arcs: An email thread visualization


InfoVis'03: Proceedings of the IEEE Symposium on Information Visualization, pages 211-218.
http://threadvis.github.io/

THREADVIS
• time-scaling
• coloring people
TREEJUXTAPOSER Rectilinear layout and interaction for
comparison of very large trees

http://www.cs.ubc.ca/~tmm/papers/tj/#video
2D, RADIAL, EXPLICIT EDGES
RADIAL NODE-LINK DRAWING
variation of layered drawing from beginning of
lecture
RADIAL NODE-LINK DRAWING
• nodes drawn on concentric circles
• nodes drawn within wedges of the
circular layout
C4
RADIAL NODE-LINK DRAWING C3
C2
• radius of Ci given by function p(i) C1
• subtree of v drawn within Wv
• to guarantee planarity (no edge v
crossings), wedge has to be convex
• several algorithms exist for figuring out
the correct angles, e.g.
annulus wedge Wv
𝑙(𝑢)𝛽𝑣
𝛽𝑢 = ,𝜏
𝑙(𝑣)

For each child u of v:


• 𝛽𝑢 is the angle of 𝑊𝑢
• 𝜏 is the angle formed by region 𝐹𝑢 u
• l(v): number of leaves in subtree rooted at v 𝐹𝑢
• place u at center of 𝑊𝑢
𝜏
Resource: Battista et al. Graph Drawing
HYPERBOLIC BROWSER
• uses hyperbolic geometry (not euclidean geometry)
• a hyperbolic plane can be displayed using the Poincaré disk
model
– a tree structure of any size fits within a finite area (circle)
– node is displayed in center
– all oder nodes move away from center and become exponentially
smaller
CHI 1996 VIDEO OF
HYPERBOLIC BROWSER
2D, AXIS-PARALLEL, IMPLICIT EDGES
A CLASSIC CONTAINMENT LAYOUT
• example tree to rebuild with treemap algorithm
• size of each node as numbers in leaves
TREEMAP ALGORITHM
• Take a rectangular display area P1(x1,y1), Q1(x2,y1)
• This area represents the root of the tree
P1

Q1
TREEMAP ALGORITHM
recursive algorithm
– the number of children of the current node define
the number of partitions of the current node
TREEMAP ALGORITHM
the weight of each node determines the
size of each partition

12 8 10 67
TREEMAP ALGORITHM
at each change of level, rotate orientation
of split by 90 degrees
2

2
12 8 2 67

3
1
TREEMAP ALGORITHM
at each change of level, rotate orientation
of split by 90 degrees
2
22
2
5
12 8 2

3 40
1
TREEMAP ALGORITHM
at each change of level, rotate orientation
of split by 90 degrees

2
6 8 11
2
5
12 8 2

3 40
1
TREEMAP
• a 2-D space-filling layout
• for further references and to try out a
treemap in various applications:
http://www.cs.umd.edu/hcil/treemap-
history/
TREEMAP VARIATIONS
• problem with original treemap: lots of long stripes
• for long stripes the areas are difficult to compare
SQUARIFIED TREEMAP
• calculates more squared regions
• problem: order not as easily read, not very stable with
dynamically changing data
ORDERED TREEMAP
several algorithms in comparison

slice and dice strip squarified ordered squarified


B. Shneiderman. Tree visualization with tree- B. B. Bederson, B. Shneiderman, and M. M. Bruls, K. Huizing, and J. van Wijk. Squarified B. Shneiderman and M. Wattenberg. Ordered
maps: 2-d space-filling approach. ACM Wattenberg. Ordered and quantum treemaps: treemaps. EuroVis, pages 33–42, 2000. treemap layouts. In Infovis01, pages 73–78,
Transactions on Graphics, 11:92–99, 1992. Making effective use of 2d space to display 2001.
hierarchies. ACM Transactions on Graphics,
21:833–854, 2002.

Readability scores: 1.0, 0.625, 0.375, 0.125 (1 = no angular change, 0=every jump
between sequential nodes requires an abrupt angular change
OTHER
VARIATIONS OF
TREEMAPS
steptree: cascaded layout:
original squarified: emphasizes structure with overlap
emphasizes leafs and their attributes emphasizes structure with extrusion

circular treemap: nested layout:


emphasizes structure with emphasizes structure with whitespace
non-space-filling primitive TVCG, 17(4), The Design Space of Implicit Hierarchy Visualization: A Survey
TRY THE IMPLICIT TREE VISUALIZATION TOOLKIT:
HTTP://VCG.INFORMATIK.UNI-ROSTOCK.DE/~HS162/ITVTK/START.HTML
3D LAYOUTS
HISTORIC EXAMPLE:
CONETREE / CAMTREE

ConeTree CamTree

[Robertson et al., 1991] George Robertson, Jock D. Mackinlay, Stuart Card. Cone Trees: Animated 3D
Visualizations of Hierarchical Information. In Proceedings of the ACM CHI 91
CONE/CAMTREE
• children of a node are
laid out in a cylinder
“below” the parent
• siblings located on the
same 2D circle
• use of animation
• shadows to enhance
structure
BOTANICAL VISUALIZATION
OF HUGE HIERARCHIES

InfoVis 2001
3D LAYOUTS
• advantages
– fit more data into same aspect ratio
– aesthetically pleasing (aka can look very sexy)
• disadvantages
– occlusion
– requires interaction or animation
– no overviews
TREE VISUALIZATION SUMMARY
• there are lots of tree visualizations
– there is also lots of free software, try it out, (see links earlier in the
lecture plus e.g.):
• http://www.informatik.uni-rostock.de/~hs162/optreedemo/TestBed.htm#
• http://w3.win.tue.nl/nl/onderzoek/onderzoek_informatica/visualization/s
equoiaview/
– there are a few overview articles, e.g.:
• A Generative Layout Approach for Rooted Tree Drawings by Hans-Jörg
Schulz, Zabed Akbar, and Frank Maurer - at IEEE PacificVis 2013
• The Design Space of Implicit Hierarchy Visualization: A Survey by Hans-
Jörg Schulz, Steffen Hadlak, and Heidrun Schumann - in IEEE TVCG 17(4)
TREE VISUALIZATIONS
• can be categorized by
– edge representations (implicit, explicit)
– dimensionality of layout
– radial vs. axis-parallel

• can be modified by
– layout parameters
– which marks are used
– visual variables on marks (which meta-data is represented?)
GRAPHS / NETWORKS
DEFINITION GRAPH
• A set of vertices V = {vi}
• A set of edges E = {eij} with eij = {vi ,vj}
• When the order of vertices of an edge is
meaningful, the graph is directed
GRAPH MEASURES
• SIZE = #nodes
• DENSITY = edges/vertices (roughly)
• PATH = sequence of edges connecting
(different) vertices
• VERTEX DEGREE = #edge connections
• DISTANCE = #hops between vertices
TWO CLASSICAL VISUAL
REPRESENTATIONS

Node-Link Diagram

Adjacency Matrix
TASKS
Find # of neighbors of a vertex (e.g. source vs.
sink)

http://mathworld.wolfram.com/DigraphSink.html
http://mathworld.wolfram.com/Source.html
TASKS
See paths (overviews, shortest, cycles)

http://mathworld.wolfram.com/GraphGeodesic.html
TASKS
Identify Sub-graphs

http://mathworld.wolfram.com/Vertex-InducedSubgraph.html
TASKS
HIGHER-LEVEL

involves many elements


involves more human judgment

• which nodes are important?


• where are clusters?
• what are attribute and connection correlations?
• how does the network change over time?
TASKS
• Many many more specific tasks
• Each application domain will add more
ATTRIBUTES
• Graph structure describes TOPOLOGY
• Vertices and edges can have attributes
– labels, weights, lengths, counts…
• Attributes can be used to adjust layouts
• Attributes add new tasks
– shortest cycle through cities with largest population
Social network visualization
Links between wiki pages
GRAPH CHALLENGES
GRAPH VISUALIZATION
CHALLENGES
SOCIAL NETWORK ANALYSIS
https://datascientistinsights.com/2014/02/18/art-of-resistance-the-social-network-
anatomy-of-a-kinetic-activist-group/

• determine if Greenpeace was or could become a


significant disruptive geopolitical force
• first: identify who/what to concentrate resources
on
SOCIAL NETWORK ANALYSIS
https://datascientistinsights.com/2014/02/18/art-of-resistance-the-social-network-
anatomy-of-a-kinetic-activist-group/
SOCIAL NETWORK ANALYSIS
1) get Facebook data using Netvizz
SOCIAL NETWORK ANALYSIS
2) load the data into Gephi https://gephi.org/

585 nodes, interconnected by 1788 edges.


“Somewhere in that spaghetti is a potential bad guy, but where?”
SOCIAL NETWORK ANALYSIS
3) choose a layout algorithm that makes sense for
social networks Force Atlas 2

provides some transparency into the


network but still lacks any real clarity
around behavioral importance
SOCIAL NETWORK ANALYSIS
4) map an attribute to size of the nodes
betweenness centrality (number of shortest paths from all vertices to
all others that pass through that node)

Bigger nodes are more central to behavioral


dynamics.

Several nodes become central figures in the


overall network.
SOCIAL NETWORK ANALYSIS
5) highlight communities
color nodes by modularity / clusters

We now begin to see a clearer picture of who is


doing what with whom.

What becomes really interesting at this stage is


understanding some of the more nuanced
relationships.
SOCIAL NETWORK ANALYSIS
6) filter, explore, label Five outlying nodes in the network (blue, maroon,
yellow, dark green, and light green).

Center: an equally important red node

Emergence of a previously un-recognized


activism player: Art of Resistance.
SOCIAL NETWORK ANALYSIS
7) communicate &
explain
LAYOUTS
Important to the success of your analysis
LAYOUT FREE Force Directed

• Physical forces
• Proximity based

• Spring Model
• Kamanda&Kawai
• Frucherman&Reingold
• Davidson&Harel
• LinLog
LAYOUT FREE
Aesthetic Criteria

• Reduce number of edge crossing


• Foster Symmetry
• Uniform edge length GRAPH DRAWING
• Aspect Ratio
• Equal Angles
• ...
LAYOUT FREE
HAND MADE

eptual organization in user-generated graph layouts


Ham, F.J.J.; Rogowitz, B.
LAYOUT CIRCULAR
• Edges on the inside
• Vertices & attributes
on the outside
• Ordering possible
LAYOUT CIRCULAR
LAYOUT 3D

Getting 3D right is difficult https://fwaris.wordpress.com/2012/07/08/a-simple-technique-for-creating-3d-


graphs-from-2d-ones/
LAYOUT 3D
Sometimes necessary
(!?)

http://gephi.forumatic.com/viewtopic.php?f=26&t=2616
LAYOUT LINEAR

http://mbostock.github.io/protovis/ex/arc-full.html
http://www.bewitched.com/song.html
LAYOUT LINEAR

https://www.openbible.info/labs
/cross-references/
LAYOUT ADJACENCY MATRIX
ADJACENCY MATRIX
LAYOUT ADJACENCY MATRIX

Communicate Explore
PROS/CONS
Matrix Node-Link
• No vertex/edge overlap or • Familiar
crossings • Compact
• Readable for dense graph • Path following easier
• Effective for small and sparse
• Fast navigation graphs

• Less familiar • Useless without layout


• Space intensive • Not readable for dense graphs
• Manipulation requires layout
• Weak for path following tasks computation
HYBRID Henry et al., NodeTrix

Dense = matrices, sparse = node-link


MULTIVARIATE NETWORKS
MULTIVARIATE NETWORKS
MULTIVARIATE NETWORKS
ADDITIONAL CHALLENGES
• TIME
• INTERACTION
• EDGE DIRECTION
NETWORK TOOLS
ACKNOWLEDGEMENTS
Slides in were inspired and adapted from slides by
• Sheelagh Carpendale (University of Calgary)
• Pat Hanrahan (Stanford University)
• Benjamin Bach (University of Edinburgh)
• Jean-Daniel Fekete (Inria)

You might also like