51
Label Placement and graph drawing Imo Lieberwerth

Presentation Imo: Powerpoint file

  • Upload
    vanliem

  • View
    221

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Presentation Imo: Powerpoint file

Label Placement and graph drawing

Imo Lieberwerth

Page 2: Presentation Imo: Powerpoint file

Overview Introduction

The Edge Label Placement problem

The Multiple Label Placement problem

Page 3: Presentation Imo: Powerpoint file

Introduction Automated label placement

originates from the Cartography Many years of research Three types:

Point labeling Line labeling Area labeling

Page 4: Presentation Imo: Powerpoint file

Point labeling Label features

like cities nodes of a

graph

Page 5: Presentation Imo: Powerpoint file

Line labeling Label features like

Rivers streets

Page 6: Presentation Imo: Powerpoint file

Rules for line labeling The label must follow the shape of the line

(but not to strict) At long lines the label must be repeated No extra white spaces between characters Vertical lines:

Left of the map: First letter towards the bottom Right of the map: First letter towards the top

Page 7: Presentation Imo: Powerpoint file

Rules according Imhof(1962)

Page 8: Presentation Imo: Powerpoint file

Area labeling Label features

like Countries Oceans

Page 9: Presentation Imo: Powerpoint file

Rules for area labeling Stretch label over whole the area Areal labels preferably have the

same shape Use horizontal or curved labels Evenly curved labels Repeat labels at suitable intervals

Page 10: Presentation Imo: Powerpoint file

Labeling quality Problem of assigning text labels to

graphical features such that association of labels is clear

The label assignment must be unambiguous

Lot of work is done by Imhof and Yoeli

Page 11: Presentation Imo: Powerpoint file

Problematic cases

Problem visibility highway 20

Problem association Thunder Bay and point

Problem readability name

Page 12: Presentation Imo: Powerpoint file

Basic rules for labeling quality

Labels should be easily read and easily and quickly located

No overlap of a label with other labels or other graphical features are allowed

Each label can be easily identified with exactly one graphical feature of the layout (the assignment is unambiguous)

Each label must be placed in the best possible position

Page 13: Presentation Imo: Powerpoint file

COST-function A optimal assignment can produces

labels that do not strictly follow the rules COST(i, j) is penalty for label j to edge i

Penalty with respect to the ranking of label j Penalty for violating the basic rules

Page 14: Presentation Imo: Powerpoint file

Labeling space

Discrete labeling space Continuous labeling space

Page 15: Presentation Imo: Powerpoint file

The ELP problem ELP: Is the problem of placing text labels

assigned to particular edges of a graph ELP problem has received little attention

Complexity is solved in 1996 and is NP-Hard by Kakoulis and Tollis

Most algorithms do not produce desired results Trapped in local optima Take exponential time

The ELP-algorithm

Page 16: Presentation Imo: Powerpoint file

The optimal ELP problemQuestion: Find a labeling assignment that minimizes the following function:

Page 17: Presentation Imo: Powerpoint file

The ELP algorithm Assumptions:

All labels have the same size Each edge has only one label associated with

it Any acceptable solution must guarantee:

Any label must be free of overlap (except his associated edge)

Any label must be very close (touch) to its associated edge

Page 18: Presentation Imo: Powerpoint file

Main idea of the algorithm Divide the input drawing into horizontal

strips of equal height Finite number of label positions

Find the set of label positions for each edge Each position must be inside a strip Each position has to touch a edge but not

intersect this edge (or other graphical feature) Each label position overlaps at most with

one other label position

Page 19: Presentation Imo: Powerpoint file

Example

1 3

2

4

Page 20: Presentation Imo: Powerpoint file

Example

31

2

4

Page 21: Presentation Imo: Powerpoint file

Example

31

2

4

Page 22: Presentation Imo: Powerpoint file

Example

31

2

4

Page 23: Presentation Imo: Powerpoint file

Matching problem Transform ELP problem where each edge

is matched to one of his label positions Group label positions together:

If two positions overlap they belong to the same group

Else to a single member group Only one member of group in assignment

Guaranties labels do not overlap each other

Page 24: Presentation Imo: Powerpoint file

Matching graph Define matching graph Gm(Ve ,Vg ,Em)

Each node e inVe corresponds to an edge Each node r in Vg corresponds to a group of

label positions Each edge(e, r) in Em connects a node e inVe to

a node r in Vg if and only if e has a label positioning that belongs to group r

Gm is a bipartite graph For each edge in Gm add the cost for

assigning label

Page 25: Presentation Imo: Powerpoint file

Example

31

2

4

1,2 3,4

g1 g3 g4g5g2

g1

g2 g3

g4 g5

g6 g6

Page 26: Presentation Imo: Powerpoint file

ELP_AlgorithmINPUT: A drawing D of the graph G(V, E)OUTPUT: A label assignment

1. Split D into horizontal strips2. Find all label positions for each edge

and construct the groups R3. Create the matching graph Gm for D4. Match edges to label positions , by

finding a matching in Gm

Page 27: Presentation Imo: Powerpoint file

Finding a matching Theorem. Let A be the set of label positions for

all edges of a drawing D of graph G(V, E). If every label position in A overlaps at most one other label position in A, then a maximum cardinality minimum weight matching of the corresponding matching graph Gm produces an optimal solution to the ELP problem with no overlaps.

You can use any known algorithm to find a maximum cardinality minimum weight matching

Page 28: Presentation Imo: Powerpoint file

Fast Matching HeuristicINPUT: Matching graph Gm

OUTPUT: A maximum cardinality matching for Gm with low weight1. IF the minimum weight incident edge a node in VE connects this

node to a node in VG of degree 1THEN Assign this edge as a matched edge

update Gm

2. IF a node in VE in has degree oneTHEN Assign its incident edge as a matched edge

update Gm3. Repeat steps 1 and 2 until no new edge can be matched4. Delete all nodes of degree 0 from Gm

FOR each node e in VE DO:Remove all but the two incidents edges of e with

the least weight5. The remaining graph consists of simple cycles and/or paths. Find

the only two maximum cardinality matchings for each component. Choose the matching of minimum weight.

Page 29: Presentation Imo: Powerpoint file

Step 1INPUT: Matching graph Gm

OUTPUT: A maximum cardinality matching for Gm with low weight1. IF the minimum weight incident edge a node in VE connects

this node to a node in VG of degree 1THEN Assign this edge as a matched edge

update Gm2. IF a node in VE in has degree one

THEN Assign its incident edge as a matched edge update Gm

3. Repeat steps 1 and 2 until no new edge can be matched4. Delete all nodes of degree 0 from Gm

FOR each node e in VE DO:Remove all but the two incidents edges of e with the

least weight5. The remaining graph consists of simple cycles and/or paths. Find the

only two maximum cardinality matchings for each component. Choose the matching of minimum weight.

Page 30: Presentation Imo: Powerpoint file

Example step 1

Vg

VeVe

Vg

Page 31: Presentation Imo: Powerpoint file

Step 2INPUT: Matching graph Gm

OUTPUT: A maximum cardinality matching for Gm with low weight1. IF the minimum weight incident edge a node in VE connects this

node to a node in VG of degree 1THEN Assign this edge as a matched edge

update Gm

2. IF a node in VE in has degree oneTHEN Assign its incident edge as a matched edge

update Gm3. Repeat steps 1 and 2 until no new edge can be matched4. Delete all nodes of degree 0 from Gm

FOR each node e in VE DO:Remove all but the two incidents edges of e with

the least weight5. The remaining graph consists of simple cycles and/or paths. Find

the only two maximum cardinality matchings for each component. Choose the matching of minimum weight.

Page 32: Presentation Imo: Powerpoint file

Example step 2

VgVg

VeVe

Page 33: Presentation Imo: Powerpoint file

Fast Matching HeuristicINPUT: Matching graph Gm

OUTPUT: A maximum cardinality matching for Gm with low weight1. IF the minimum weight incident edge a node in VE connects this

node to a node in VG of degree 1THEN Assign this edge as a matched edge

update Gm

2. IF a node in VE in has degree oneTHEN Assign its incident edge as a matched edge

update Gm3. Repeat steps 1 and 2 until no new edge can be matched4. Delete all nodes of degree 0 from Gm

FOR each node e in VE DO:Remove all but the two incidents edges of e with

the least weight5. The remaining graph consists of simple cycles and/or paths. Find

the only two maximum cardinality matchings for each component. Choose the matching of minimum weight.

Page 34: Presentation Imo: Powerpoint file

Fast Matching HeuristicINPUT: Matching graph Gm

OUTPUT: A maximum cardinality matching for Gm with low weight1. IF the minimum weight incident edge a node in VE connects this

node to a node in VG of degree 1THEN Assign this edge as a matched edge

update Gm

2. IF a node in VE in has degree oneTHEN Assign its incident edge as a matched edge

update Gm3. Repeat steps 1 and 2 until no new edge can be matched4. Delete all nodes of degree 0 from Gm

FOR each node e in VE DO:Remove all but the two incidents edges of e with

the least weight5. The remaining graph consists of simple cycles and/or paths. Find

the only two maximum cardinality matchings for each component. Choose the matching of minimum weight.

Page 35: Presentation Imo: Powerpoint file

Example step 4

Vg Vg

VeVe

Page 36: Presentation Imo: Powerpoint file

Fast Matching HeuristicINPUT: Matching graph Gm

OUTPUT: A maximum cardinality matching for Gm with low weight1. IF the minimum weight incident edge a node in VE connects this

node to a node in VG of degree 1THEN Assign this edge as a matched edge

update Gm

2. IF a node in VE in has degree oneTHEN Assign its incident edge as a matched edge

update Gm3. Repeat steps 1 and 2 until no new edge can be matched4. Delete all nodes of degree 0 from Gm

FOR each node e in VE DO:Remove all but the two incidents edges of e with

the least weight5. The remaining graph consists of simple cycles and/or paths. Find

the only two maximum cardinality matchings for each component. Choose the matching of minimum weight.

Page 37: Presentation Imo: Powerpoint file

Example step 5 Traverse cycle (or path) and pick only the even

or odd edges as part of the matching

Vg

Ve

Vg

Ve

Page 38: Presentation Imo: Powerpoint file

Remark Algorithm don’t label horizontal

edges

Solution: rotate the drawing

Page 39: Presentation Imo: Powerpoint file

Extension and results Post processing step:

Relaxing the restrictions by allowing labels to overlap their associated edges

The algorithm works very well for hierarchical and other straight-line drawing

Not suitable for orthogonal drawings

Page 40: Presentation Imo: Powerpoint file

Result algorithm

Page 41: Presentation Imo: Powerpoint file

The MLP problem Konstantinos G. Kakoulis and Ioannis G. Tollis. On

the multiple label placement problem. In Proc. 10th Canadian Conf. Computational Geometry (CCCG’98), pages 66–67, 1998.

Each graphical feature is associated with more then one label

Constraints: example with single edge and source and target node

Proximity: Label Ls must be in close proximity with source node. Define maximum distance

Partial Order: The source node label must closer to the source node then the other label. Define a partial order

Priority: First important labels and then the other labels if there is a space

Page 42: Presentation Imo: Powerpoint file

Algorithm 1 Algorithm for solving the MLP problem Iterative approach

Main loop i-th iteration of the loop, assigns the i-th label

for graphical feature This algorithm can take into account all

three constraints This algorithm can use the ELP-algorithm

Page 43: Presentation Imo: Powerpoint file

Example

An orthogonal drawing A hierarchical drawing

Page 44: Presentation Imo: Powerpoint file

Algorithm 2 Non-iterative fashion and extension

of ELP-algorithm Sketch algorithm:

Find set of label positions for each graphical feature

Label positions that overlap each other are grouped in clusters

Each cluster is matched to at most one graphical feature using flow techniques

Page 45: Presentation Imo: Powerpoint file

Graphs First create bipartite graph matching

graph Gm(Vf , Vc , Em) Each graphical feature is represented by a

node in Vf

Each cluster is represented by a node in Vc

Each edge in Em connect Then transform Gm to a flow graph

Gflow(s, t,Vf , Vc , Em)

Page 46: Presentation Imo: Powerpoint file

Flow graph

The flow graph of algorithm 2

Page 47: Presentation Imo: Powerpoint file

Flow graph Assign capacities:

Each edge of original matching graph has capacity one

Each edge (c, t) has capacity one Each edge (s, v) has capacity equal to the

number of labels associated with v Include the cost of the label positioning

for each edge Solve the maximum flow minimum cost

problem for the flow graph Gflow

Page 48: Presentation Imo: Powerpoint file

Flow graph

The flow graph of algorithm 2

Page 49: Presentation Imo: Powerpoint file

Example

Circular drawing with 3 labels per edge and node

Page 50: Presentation Imo: Powerpoint file

Experimental Results Both algorithms perform well and the

same with respect to the success rate

The flow method produces a slightly better quality of label assignments

If labels have variable size the algorithm 1 would be the best choice

Page 51: Presentation Imo: Powerpoint file

Questions?