Visualization of Disagreement-based Quality Metrics of Crowdsourcing Data
Graph Visualization: Topology-Shape-Metrics
Transcript of Graph Visualization: Topology-Shape-Metrics
Topology-Shape-Metrics
1. Background
โข Planarity
โข Topology
2. The topology-shape-metrics approach
1. Topology
2. Shape
3. Metrics
3. Remarks
7
5
1
9
6
2
3
4
0
8
A graph drawing
is planar if it has no edge crossings.
7
5
1
9
6
2
3
4
0
8
A planar graph drawing A non-planar graph drawing
Edge crossing
Note: Planar drawings make beautiful pictures
Mary Bob
Peter
Jon
DavidF
Alan
Joseph
Judy
Albert
DavidE
Peter
Mary
Jon
DavidF
Alan
Joseph
Bob Judy
Albert
DavidE
Bad picture Good picture
A graph
is planar
if it can be drawn without edge crossings.
0 1 2 3 4 5 6 7 8 9
0 1 1
1 1 1 1
2 1 1 1
3 1 1
4 1 1 1 1
5 1 1 1 1
6 1 1
7 1 1 1
8 1 1 1
9 1 1
A planar graph ๐ฎ๐
0 1 2 3 4 5
0 1 1 1
1 1 1 1
2 1 1 1
3 1 1 1
4 1 1 1
5 1 1 1
A nonplanar graph ๐ฎ๐
7
5
1
9
6
2
3
4
0
8
Lemma:
๐ฎ๐ is planar.
0 1 2 3 4 5 6 7 8 9
0 1 1
1 1 1 1
2 1 1 1
3 1 1
4 1 1 1 1
5 1 1 1 1
6 1 1
7 1 1 1
8 1 1 1
9 1 1
Proof
A graph ๐ฎ is non-planar if every drawing of ๐ฎ has edge crossings.
0 1 2 3 4 5
0 1 1 1
1 1 1 1
2 1 1 1
3 1 1 1
4 1 1 1
5 1 1 1
A nonplanar graph ๐ฎ๐
Kuratowskiโs Theorem (1930)
A graph is planar if and only if it does not contain a subgraph that is a subdivision of ๐ฒ๐ or ๐ฒ๐,๐.
๐ฒ๐ (the complete graph on 5
vertices) subdivision
๐ฒ๐,๐ (complete bipartite graph on 6
vertices) subdivision
Note: There are many beautiful theorems about planar graphs
Kuratowskiโs Theorem (1930)
A graph is planar if and only if it does not contain a subgraph that is a subdivision of ๐ฒ๐ or ๐ฒ๐,๐.
Note: There are many beautiful theorems about planar graphs
Corollary
๐ฎ๐ is non-planar 0 1 2 3 4 5
0 1 1 1
1 1 1 1
2 1 1 1
3 1 1 1
4 1 1 1
5 1 1 1
A nonplanar graph ๐ฎ๐
Proof:
๐ฎ๐ is ๐ฒ๐,๐.
Theorem: A graph is planar if and only if each of its triconnected components is
planar.
Note: There are many beautiful theorems about planar graphs
Theorem: (Appel-Haken) A planar graph can be colored in 4 colors.
Theorem: (from Euler) For a planar graph ๐ฎ = (๐ฝ, ๐ฌ), ๐ฌ โค ๐ ๐ฝ โ ๐. If ๐ฌ = ๐ ๐ฝ โ ๐, then ๐ฎ is triconnected and each face of the
embedding of ๐ฎ has 3 edges.
Theorem: (Steinitz) For every triconnected planar graph ๐ฎ, there is a convex
polyhedron ๐ท in 3D such that the vertex-edge graph of ๐ท is
isomorphic to ๐ฎ.
Theorem: (Lipton-Tarjan separator) For every planar graph ๐ฎ with ๐ vertices, there is set of ๐ถ ๐ vertices whose removal divides the graph into
components of size at most ๐๐
๐.
Remarks: Planar graphs and real-world graphs
Most real-world graphs are not planar
But most are โnearlyโ planar in that deletion of ๐(๐) edges gives a planar graph
โข scale-free networks are locally dense and globally sparse
Planarity testing algorithms
Hopcroft-Tarjan planarity testing algorithm (1974)
Tests whether a graph is planar or not, in linear time
Very complicated algorithm; implementation difficult
โข First published version incorrect; corrected by Deo (1976)
โข Most implementations incorrect
โข First correct implementation (I believe) 1994.
Many subsequent planarity testing algorithms
Lempel-Even-Cederbaum 1966
Booth-Lueker 1976
Rosensthiel-de Frayssieux 1990
Hsu/Boyer-Myvold 2000
Note:
All these planarity testing algorithms are efficient and effective, but none is elegant.
Finding an elegant linear time planarity testing algorithm is still an unsolved
problem.
Graph
(topological) Embedding
Graph drawing
No geometry, just a combinatorial object
A geometric and visual object
A graph drawing divides
the plane into regions
called faces.
๐ญ๐
๐ญ๐ ๐ญ๐
๐ญ๐
๐ญ๐
๐ญ๐
๐ญ๐
๐ญ๐
๐ญ๐ ๐ญ๐
๐ญ๐
The faces plus their adjacencies form
the dual graph of the drawing.
๐ญ๐
๐ญ๐
๐ญ๐
๐ญ๐ ๐ญ๐
๐ญ๐
๐ญ๐ ๐ญ๐
๐ญ๐
๐ญ๐ ๐ญ๐
๐ญ๐
Definition:
Two drawings of a graph are topologically equivalent if there is a homeomorphism
of the plane/sphere that maps one to the other.
1
3 5
8 4 6
2 0
7
1
3
5
8
4
6
2
0
7
1
3 5
8
4 6
2 0
7
Alternative definitions:
Two drawings of a graph are topologically equivalent if
1. they have the โsameโ dual graph, or alternatively
2. they have the same clockwise circular ordering of edges around each vertex.
Topologically equivalent Not topologically equivalent
1
3 5
8 4 6
2 0
7
1
3
5
8
4
6
2
0
7
0 8,1,5
1 5,0,2,6
2 1,3
3 6,2,7
4 8,5,6
5 8,0,1,4
6 4,1,3,7
7 6,3
8 0,5,4
0 5,8,1
1 6,5,0,2
2 3,1
3 7,6,2
4 8,5,6
5 4,8,0,1
6 4,1,3,7
7 6,3
8 4,0,5
Same
topological
embedding
Same clockwise circular
orderings of edges around each vertex
Definition:
Two drawings of a graph are topologically equivalent if there is a homeomorphism
of the plane/sphere that maps one to the other.
Definition:
A (topological) embedding of a graph ๐ฎ is an equivalence
class of drawings of ๐ฎ under topological equivalence.
Data structure for planar embeddings:
a) List of vertices.
b) For each vertex ๐, a circular list of vertices ๐ adjacent to ๐.
1
3 5
8 4 6
2 0
7
0 8,1,5
1 5,0,2,6
2 1,3
3 6,2,7
4 8,5,6
5 8,0,1,4
6 4,1,3,7
7 6,3
8 0,5,4
Alternative definitions:
An embedding consists of
1. A graph, โplusโ the dual graph.
2. A graph, plus a clockwise circular ordering of
edges around each vertex.
A non-planar embedding can be planarized by placing dummy vertices at the edge
crossings.
planarize
planarize
A non-planar embedding can be planarized by placing dummy vertices at the edge
crossings.
planarize
Note:
โข The concept of planarization allows us to apply terminology, definitions, and
data structures about planar embeddings to non-planar embeddings.
โข If the number of crossing points is small, then planarization might not increase
asymptotic time complexity of algorithms
โข Normally, we use planarization to give a data structure for a non-planar
embedding
Planar embedding algorithms
Most planarity testing algorithms โcan be adjustedโ to output a planar
embedding of a planar graph in linear time.
All these algorithms are efficient and effective; none is elegant.
A drawing of a graph ๐ฎ = (๐ฝ, ๐ฌ) consists of
โข a location ๐(๐) for each vertex ๐, and
โข a Jordan arc ๐(๐, ๐) for each edge (๐, ๐) such that the endpoints
of ๐(๐, ๐) are ๐(๐) and ๐(๐).
โข (plus a lot of nondegeneracy conditions)
There are many kinds of graph drawings
Grid drawing: vertices (and edge bends?) are located at integer grid points
Polyline drawing: edges are polylines
Straight-line drawing: edges are straight line segments
Orthogonal drawing: edges are polylines made up of vertical and horizontal
line segments
โฆ.
โฆ..
5
2 0 1
8
3 7 4 6
Straight-line drawing
5
2 0 1
8
3 7 4 6
Polyline drawing
A drawing of a graph ๐ฎ = (๐ฝ, ๐ฌ) consists of
โข a location ๐(๐) for each vertex ๐, and
โข a Jordan arc ๐(๐, ๐) for each edge (๐, ๐) such that the endpoints
of ๐(๐, ๐) are ๐(๐) and ๐(๐).
5
2 0
1
8
3
7
4
6
Orthogonal drawing
5
2
0 1
8
3 7 4 6
Grid drawing
A drawing of a graph ๐ฎ = (๐ฝ, ๐ฌ) consists of
โข a location ๐(๐) for each vertex ๐, and
โข a Jordan arc ๐(๐, ๐) for each edge (๐, ๐) such that the endpoints
of ๐(๐, ๐) are ๐(๐) and ๐(๐).
5
2
1
8
3
7
4
6
0
Orthogonal grid drawing
A drawing of a graph ๐ฎ = (๐ฝ, ๐ฌ) consists of
โข a location ๐(๐) for each vertex ๐, and
โข a Jordan arc ๐(๐, ๐) for each edge (๐, ๐) such that the endpoints
of ๐(๐, ๐) are ๐(๐) and ๐(๐).
Graph
(topological) Embedding
Graph drawing
No geometry, just a combinatorial object
A geometric and visual object
A topological but not geometric object
Topology-shape-metrics approach:
Input: a graph ๐ฎ
Algorithm:
1. Topology: Compute a good topological
embedding of ๐ฎ
2. Shape: Compute a good orthogonal
shape for this topological embedding
3. Metrics: Compute a good orthogonal grid
drawing of ๐ฎ
Output: an orthogonal grid drawing of ๐ฎ
Aim: produce an embedding with few edge crossings
1. Topology-shape metrics method
Input: a graph ๐ฎ = (๐ฝ, ๐ฌ)
a) Compute a planar subgraph ๐ฎโฒ = ๐ฝ, ๐ฌโฒ , where ๐ฌโฒ is a subset of ๐ฌ, such that ๐ฌโฒ is as large as possible.
b) Compute a planar embedding ๐ฎโฒโฒ of ๐ฎโฒ.
c) Insert the edges of ๐ฌ โ ๐ฌโฒ into ๐ฎโฒโฒ, creating as few crossings as
possible, to create an embedding ๐ฎโฒโฒโฒ of ๐ฎ.
Output: an embedding of ๐ฎ with few crossings
Use a maximum-planar-subgraph method
We need solutions for a difficult problem:
The most successful approach to MPS so far is integer linear programming
Note
MPS is NP-complete
Many heuristic approaches have been investigated, implemented,
and tested over at least the last 30 years
Maximum Planar Subgraph (MPS)
Input: a graph ๐ฎ
Output: a planar subgraph of ๐ฎ with a maximum number of edges.
Integer Linear Program for the Maximum Planar Subgraph problem
Given a graph ๐ฎ = (๐ฝ, ๐ฌ):
Variables
๐๐ for each edge ๐ โ ๐ฌ
Objective
Maximize ๐๐๐โ๐ฌ
Constraints
a) ๐๐ โ ๐, ๐
b) For each Kuratowski subgraph ๐ฒ = ๐ฝ๐ฒ, ๐ฌ๐ฒ of ๐ฎ:
๐๐๐โ๐ฌ๐ฒ
โค ๐ฌ๐ฒ
Interpetation:
๐๐ = ๐ if ๐ โ ๐ฌโฒ๐ otherwise
Algorithm:
Use a traditional โbranch&cutโ approach, with cutting planes from theorems on planar graphs.
1. Topology: Compute a good topological embedding of ๐ฎ
Input: a graph ๐ฎ = (๐ฝ, ๐ฌ)
a) Compute a planar subgraph ๐ฎโฒ = ๐ฝ, ๐ฌโฒ , where ๐ฌโฒ is a subset of ๐ฌ, such that ๐ฌโฒ is as large as possible.
b) Compute a planar embedding ๐ฎโฒโฒ of ๐ฎโฒ.
c) Insert the edges of ๐ฌ โ ๐ฌโฒ into ๐ฎโฒโฒ, creating as few crossings as possible, to create an embedding ๐ฎโฒโฒโฒ of ๐ฎ.
Output: an embedding of ๐ฎ with few crossings
Use planar embedding algorithms
- For example, a variation on the Hopcroft-Tarjan planarity algorithm
1. Topology: Compute a good topological embedding of ๐ฎ
Input: a graph ๐ฎ = (๐ฝ, ๐ฌ)
a) Compute a planar subgraph ๐ฎโฒ = ๐ฝ, ๐ฌโฒ , where ๐ฌโฒ is a subset of ๐ฌ, such that ๐ฌโฒ is as large as possible.
b) Compute a planar embedding ๐ฎโฒโฒ of ๐ฎโฒ.
c) Insert the edges of ๐ฌ โ ๐ฌโฒ into ๐ฎโฒโฒ, creating as few crossings as possible, to create an embedding ๐ฎโฒโฒโฒ of ๐ฎ.
Output: an embedding of ๐ฎ with few crossings
Use planar shortest path in the dual
To insert an edge
(๐, ๐) โ ๐ฌ โ ๐ฌโฒ into
๐ฎโฒโฒ:
Construct the dual
graph of ๐ฎโฒโฒ
Let ๐๐ be the set of
faces containing ๐
Let ๐๐ be the set of
faces containing ๐
Route (๐, ๐) via a
shortest path from
๐๐ to ๐๐.
1
3 5
8 4 6
2 0
7
1
3 5
8 4 6
0
7
1
3
5
8 4 6
2 0
7
1
3 5
8 4 6
2 0
7
1
5
8 4 6
2 0
7
1 2
1
5
8 4
6
0
v
u
Topology-shape-metrics approach:
Input: a graph ๐ฎ
Algorithm:
1. Topology: Compute a good topological
embedding of ๐ฎ
2. Shape: Compute a good orthogonal
shape for this topological embedding
3. Metrics: Compute a good orthogonal grid
drawing of ๐ฎ
Output: an orthogonal grid drawing of ๐ฎ
Aim: give shape with a small number of edge bends.
The shape of a directed orthogonal edge is the sequence of North/South/East/West turns.
๐
๐
Shape of (๐, ๐):๐ฌ๐ต๐ฌ๐ต๐ฌ๐บ๐ฌ
East
East
East
East N
ort
h
No
rth
So
uth
The shape of an orthogonal drawing
consists of the shape of each edge
(after directing edges arbitrarily)
1
3 5
8
4 6
2 0
7
05 WSE
10 W
12 E
16 S
23 ESW
45 W
48 NW
58 N
64 W
73 S
76 WSW
80 N
2. Shape:
Compute a good orthogonal shape for the topological embedding output
from the topology step.
We want a small number of bends
Minimum Bends Problem
Input: An embedding ๐ฎ
Output: A shape for ๐ฎ with a minimum number of bends.
Surprising result
Theorem (Tamassia, ~1987)
The Minimum Bends Problem can be solved in polynomial time.
๐ถ ๐๐.๐๐ ๐๐๐๐
Tamassiaโs algorithm to give a shape with a minimum total number of bends
5
2 0
8
3
7
โข Note that ๐
2 angles in a drawing satisfy some
linear constraints
- The sum of angles around a face is
๐ ๐ + ๐ โ ๐๐
๐ , where ๐ is the number of
vertices and ๐ is the number of bends in the face.
- The sum of angles around a vertex is ๐๐
๐.
- โฆ plus other constraints from theorems on planar graphs
- โฆ
- โฆ
โข These constraints can be modelled as a minimum flow problem
โข We can solve the minimum flow problem in polynomial time.
Alternative method to give a shape with a small number of bends
1. Create a visibility representation of the input embedding
2. Adjust the visibility representation to give an orthogonal shape
Runs in linear time
Relatively elegant
Does not give a minimum total number
of bends
But guarantees that the number of
bends on an edge is at most 4. 5
2 0
3
7
5
2 0
3
7
Topology-shape-metrics approach:
Input: a graph ๐ฎ
Algorithm:
1. Topology: Compute a good topological
embedding of ๐ฎ
2. Shape: Compute a good orthogonal
shape for this topological embedding
3. Metrics: Compute a good orthogonal grid
drawing of ๐ฎ
Output: an orthogonal grid drawing of ๐ฎ
Aim: give a drawing with good vertex resolution
Metrics step: Use VLSI-inspired compaction methods to get a drawing on a small grid
Compaction in the ๐ direction
1. Construct a directed visibility graph ๐ฏ on the dual with source at the left and
sink at the right.
2. For each vertex ๐ in ๐ฏ, find a longest path in ๐ฏ from the source to ๐.
3. Assign ๐-coordinates using path-length from the source.
5
2 0
1
8
3
7
4
6
Compaction in the ๐ direction
1. Construct a directed visibility graph ๐ฏ on the dual with source at the left and
sink at the right.
2. For each vertex ๐ in ๐ฏ, find a longest path in ๐ฏ from the source to ๐.
3. Assign ๐-coordinates using path-length from the source.
Similarly compact in the ๐-direction.
5
2 0
1
8
3
7
4
6
Topology-shape-metrics approach
Good things
โข Works well on small graphs
โข Relatively fast (varies from ๐ถ(๐) to ๐ถ ๐๐๐๐๐ ๐ )
โข Validated readability
โข Can be adjusted to handle vertices of large degree and large size
โข Can be adjusted for some constraints
Kle
in
Kle
in