Page 1
Combining Traditional Map Labeling with Boundary Labeling
[Sofsem 2011]
M. A. Bekos1, M. Kaufmann2, D. Papadopoulos1, A. Symvonis1
1 School of Applied Mathematical & Physical Sciences,
National Technical University of Athens, Greece
{mikebekos,dpapadopoulos,symvonis}@math.ntua.gr
2 University of Tubingen, Institute for Informatics, Germany
[email protected]
Sofsem 11 (2011/01/27) Mixed Labeling 1 / 29
Page 2
Map Labeling
Sofsem 11 (2011/01/27) Mixed Labeling 2 / 29
Page 3
Map Labeling
Sofsem 11 (2011/01/27) Mixed Labeling 2 / 29
Page 4
Known Map Labeling Models
1 Fixed Position Models:
1-position 2-position 4-position
2 Sliding Models:
1-slider 2-slider 4-slider
Sofsem 11 (2011/01/27) Mixed Labeling 3 / 29
Page 5
Boundary Labeling: A Different Labeling Approach
• Large Labels → Overlaps.
• The map contains information, which must not be obscured.
Sofsem 11 (2011/01/27) Mixed Labeling 4 / 29
Page 6
Boundary Labeling: A Different Labeling Approach
• Large Labels → Overlaps.
• The map contains information, which must not be obscured.
Sofsem 11 (2011/01/27) Mixed Labeling 4 / 29
Page 7
The Boundary Labeling Model.
According to Boundary Labeling Model:
• Labels are placed on the boundary of a rectangle R (enclosing rectangle).
• Each site is connected to its label by non-intersected polylines (leaders).
• The labels can be attached to one, two or all four sides of R.
Drawing
R
Sofsem 11 (2011/01/27) Mixed Labeling 5 / 29
Page 8
Boundary Labeling: Leader Types
Different Types of Leaders:
• Straight-line type-s.
• Rectilinear type-po and type-opo.
• Octilinear type-do/od/pd.
R
Type-s leaders
R
Type-po leaders
RTrack Routing Area
Type-opo leaders
R
Type-do/od/pd leaders
Sofsem 11 (2011/01/27) Mixed Labeling 6 / 29
Page 9
Can we Combine Both Approaches?
Sofsem 11 (2011/01/27) Mixed Labeling 7 / 29
Page 10
Can we Combine Both Approaches?
Sofsem 11 (2011/01/27) Mixed Labeling 7 / 29
Page 11
Mixed Labeling
Input:
• Sites: P = {s1, s2, . . . sn}, si = (xi, yi)
• Labels: L = {`1, `2, . . . `n}• Internal
• External
• Enclosing rectangle R
• Model: (m, k, t)
• m ∈ {1P, 2P, 4P, 1S, 2S, 4S}• k ∈ {Left-Sided, Right-Sided, Two-Sided}• t ∈ {s, po, opo, do, od, pd}
Sofsem 11 (2011/01/27) Mixed Labeling 8 / 29
Page 12
Mixed Labeling
Output:
• Legal Labeling:
• Non-overlapping Internal Labels.
• Non-intersecting Leaders.
• No intersections among Leaders and Internal Labels
• Optimization: Maximize the no of internal labels
Sofsem 11 (2011/01/27) Mixed Labeling 9 / 29
Page 13
Previous Work
Formann and Wagner [1991]:
• ∃ overlap-free labeling under 4-position? → NP-complete.
Iturriaga and Lubiw [1997]:
• ∃ overlap-free labeling under 1-slider? → NP-complete.
⇒ Any mixed labeling problem with 4P or any slider model is difficult.
Fowler, Paterson, Tanimoto [1981]:
• Maximize the no. of non-overlapping labels under 1-position → NP-complete.
∃ variants where we can give an algorithm that maximizes the no. of internal labels
Sofsem 11 (2011/01/27) Mixed Labeling 10 / 29
Page 14
Previous Work
Formann and Wagner [1991]:
• ∃ overlap-free labeling under 4-position? → NP-complete.
Iturriaga and Lubiw [1997]:
• ∃ overlap-free labeling under 1-slider? → NP-complete.
⇒ Any mixed labeling problem with 4P or any slider model is difficult.
Fowler, Paterson, Tanimoto [1981]:
• Maximize the no. of non-overlapping labels under 1-position → NP-complete.
∃ variants where we can give an algorithm that maximizes the no. of internal labels
Sofsem 11 (2011/01/27) Mixed Labeling 10 / 29
Page 15
Previous Work
Formann and Wagner [1991]:
• ∃ overlap-free labeling under 4-position? → NP-complete.
Iturriaga and Lubiw [1997]:
• ∃ overlap-free labeling under 1-slider? → NP-complete.
⇒ Any mixed labeling problem with 4P or any slider model is difficult.
Fowler, Paterson, Tanimoto [1981]:
• Maximize the no. of non-overlapping labels under 1-position → NP-complete.
∃ variants where we can give an algorithm that maximizes the no. of internal labels
Sofsem 11 (2011/01/27) Mixed Labeling 10 / 29
Page 16
Previous Work
Formann and Wagner [1991]:
• ∃ overlap-free labeling under 4-position? → NP-complete.
Iturriaga and Lubiw [1997]:
• ∃ overlap-free labeling under 1-slider? → NP-complete.
⇒ Any mixed labeling problem with 4P or any slider model is difficult.
Fowler, Paterson, Tanimoto [1981]:
• Maximize the no. of non-overlapping labels under 1-position → NP-complete.
∃ variants where we can give an algorithm that maximizes the no. of internal labels
Sofsem 11 (2011/01/27) Mixed Labeling 10 / 29
Page 17
The (1P, Right-Sided, opo) Mixed Labeling Model
• Internal labels: 1P
• External labels: Right
• Leaders: opo
Sofsem 11 (2011/01/27) Mixed Labeling 11 / 29
Page 18
The (1P, Right-Sided, opo) Mixed Labeling Model
Property:
ab
ab
ab
Sofsem 11 (2011/01/27) Mixed Labeling 12 / 29
Page 19
The (1P, Right-Sided, opo) Mixed Labeling Model
1 Start with boundary labeling.
2 Identify overlaps and mark leaders
permanent.
3 If no permanent leader crosses the
internal label of a site, then remove
the leader and place an internal
label.
Complexity: O(n log2 n)
Sofsem 11 (2011/01/27) Mixed Labeling 13 / 29
Page 20
The (1P, Right-Sided, opo) Mixed Labeling Model
1 Start with boundary labeling.
2 Identify overlaps and mark leaders
permanent.
3 If no permanent leader crosses the
internal label of a site, then remove
the leader and place an internal
label.
Complexity: O(n log2 n)
Sofsem 11 (2011/01/27) Mixed Labeling 13 / 29
Page 21
The (1P, Right-Sided, opo) Mixed Labeling Model
1 Start with boundary labeling.
2 Identify overlaps and mark leaders
permanent.
3 If no permanent leader crosses the
internal label of a site, then remove
the leader and place an internal
label.
Complexity: O(n log2 n)
Sofsem 11 (2011/01/27) Mixed Labeling 13 / 29
Page 22
The (1P, Right-Sided, opo) Mixed Labeling Model
1 Start with boundary labeling.
2 Identify overlaps and mark leaders
permanent.
3 If no permanent leader crosses the
internal label of a site, then remove
the leader and place an internal
label.
Complexity: O(n log2 n)
Sofsem 11 (2011/01/27) Mixed Labeling 13 / 29
Page 23
The (1P, Right-Sided, opo) Mixed Labeling Model
1 Start with boundary labeling.
2 Identify overlaps and mark leaders
permanent.
3 If no permanent leader crosses the
internal label of a site, then remove
the leader and place an internal
label.
Complexity: O(n log2 n)
Sofsem 11 (2011/01/27) Mixed Labeling 13 / 29
Page 24
The (1P, Left-Sided, opo) Mixed Labeling Model
• Internal labels: 1P
• External labels: Left
• Leaders: opo
Sofsem 11 (2011/01/27) Mixed Labeling 14 / 29
Page 25
The (1P, Left-Sided, opo) Mixed Labeling Model
Previous property is not applied:
ab
ab
ab
Sofsem 11 (2011/01/27) Mixed Labeling 15 / 29
Page 26
The (1P, Left-Sided, opo) Mixed Labeling Model
Idea: Use Recursion
1 Fix an internal label.
2 Split into half-sized subproblems.
3 Recursively solve the subproblems
4 Keep the solution which maximizes number of internal labels.
Sofsem 11 (2011/01/27) Mixed Labeling 16 / 29
Page 27
The (1P, Left-Sided, opo) Mixed Labeling Model
1 Splitting Line: L
2 Fix s: leftmost with internal label.
3 Recurse.
L
R
T (k) =
{2kT (k/2) + n2 log2 n, k > 1
O(1), k = 1
Complexity: O(nlogn+3)
Sofsem 11 (2011/01/27) Mixed Labeling 17 / 29
Page 28
The (1P, Left-Sided, opo) Mixed Labeling Model
1 Splitting Line: L
2 Fix s: leftmost with internal label.
3 Recurse.
Ls
R
Rs
T (k) =
{2kT (k/2) + n2 log2 n, k > 1
O(1), k = 1
Complexity: O(nlogn+3)
Sofsem 11 (2011/01/27) Mixed Labeling 17 / 29
Page 29
The (1P, Left-Sided, opo) Mixed Labeling Model
1 Splitting Line: L
2 Fix s: leftmost with internal label.
3 Recurse.
Ls
R
Rs
T (k) =
{2kT (k/2) + n2 log2 n, k > 1
O(1), k = 1
Complexity: O(nlogn+3)
Sofsem 11 (2011/01/27) Mixed Labeling 17 / 29
Page 30
The (1P, Left-Sided, opo) Mixed Labeling Model
1 Splitting Line: L
2 Fix s: leftmost with internal label.
3 Recurse.
Ls
R
Rs
T (k) =
{2kT (k/2) + n2 log2 n, k > 1
O(1), k = 1
Complexity: O(nlogn+3)
Sofsem 11 (2011/01/27) Mixed Labeling 17 / 29
Page 31
The (1P, Left-Sided, opo) Mixed Labeling Model
• Can we obtain a more efficient algorithm?
• Idea: Relax the optimality constraint.
Sofsem 11 (2011/01/27) Mixed Labeling 18 / 29
Page 32
The (1P, Left-Sided, opo) Mixed Labeling Model
• ∀ site si → variable zi
• zi = true ⇔ si is labeled external
• zi = true ⇔ si is labeled internal
(a) Internal Labels Overlap: zi ∨ zj(b) Site - Internal Label: zi
(c) Internal Label - Leader: zi ∨ zj
sisj
sisj
sj
si
(a)
(b)
(c)
2-Sat with n variables, O(n2) clauses: Need a solution with min no of true variables.
⇒ 2-Approximation of O(n3) time [Gusfield and Pitt 1992]
Sofsem 11 (2011/01/27) Mixed Labeling 19 / 29
Page 33
The (1P, Left-Sided, opo) Mixed Labeling Model
• ∀ site si → variable zi
• zi = true ⇔ si is labeled external
• zi = true ⇔ si is labeled internal
(a) Internal Labels Overlap: zi ∨ zj(b) Site - Internal Label: zi
(c) Internal Label - Leader: zi ∨ zj
sisj
sisj
sj
si
(a)
(b)
(c)
2-Sat with n variables, O(n2) clauses: Need a solution with min no of true variables.
⇒ 2-Approximation of O(n3) time [Gusfield and Pitt 1992]
Sofsem 11 (2011/01/27) Mixed Labeling 19 / 29
Page 34
The (1P, Two-Sided, opo) Mixed Labeling Model
• Internal labels: 1P
• External labels: Left-Right
• Leaders: opo
Sofsem 11 (2011/01/27) Mixed Labeling 20 / 29
Page 35
The (1P, Two-Sided, opo) Mixed Labeling Model
• Internal labels: 1P
• External labels: Left-Right
• Leaders: opo
• Extra assumptions:
1 Uniform Label height: h
2 Each slice of height h
contains at most λ sites.
Sofsem 11 (2011/01/27) Mixed Labeling 21 / 29
Page 36
The (1P, Two-Sided, opo) Mixed Labeling Model
Idea: Use Recursion (similar to previous quasi-polynomial time algorithm)
1 Fix two labels.
2 Split into “half-sized” subproblems.
3 Recursively solve the subproblems
4 Keep the solution which maximizes number of internal labels.
Sofsem 11 (2011/01/27) Mixed Labeling 22 / 29
Page 37
The (1P, Two-Sided, opo) Mixed Labeling Model
1 Splitting Line: L
2 Fix s: leftmost with internal label.
3 Fix t: leftmost with external label.
4 Recurse.
Ls
Ltop
Lbottom
R
Rs
R1
R2
R3
t
T (n) ≤
{λ2(2T (n/2 + λ) + n log2 n), n > 3λ
33λλ log2 λ, n ≤ 3λ
Complexity: (n/λ)O(log λ) · 3O(λ)
Sofsem 11 (2011/01/27) Mixed Labeling 23 / 29
Page 38
The (1P, Two-Sided, opo) Mixed Labeling Model
1 Splitting Line: L
2 Fix s: leftmost with internal label.
3 Fix t: leftmost with external label.
4 Recurse.
Ls
Ltop
Lbottom
R
Rs
R1
R2
R3
t
T (n) ≤
{λ2(2T (n/2 + λ) + n log2 n), n > 3λ
33λλ log2 λ, n ≤ 3λ
Complexity: (n/λ)O(log λ) · 3O(λ)
Sofsem 11 (2011/01/27) Mixed Labeling 23 / 29
Page 39
Generalizations
A λ-height restricted instance of the (m, k, opo) problem, where m ∈ {2P, 4P},k ∈ {∅, Left-Sided, Right-Sided, Two-Sided} can be solved in time
(n/λ)O(λ log κ) · (κ+ µ)λ+1
Sofsem 11 (2011/01/27) Mixed Labeling 24 / 29
Page 40
Experimental Results
We have implemented:
1 Polynomial time algorithm: (1P, Right-Sided, opo)
2 Quasi-polynomial time algorithm: (1P, Left-Sided, opo)
3 λ-parameterized algorithm: (1P, Two-Sided, opo)
Evaluation Parameter: Density = total area of all labelsarea of enclosing rectangle
Sofsem 11 (2011/01/27) Mixed Labeling 25 / 29
Page 41
Experimental Results: Time Complexity
Low Density 1/10 High Density 1/6
• X-axis: Number of points
• Y -axis: Running time measured in sec
Note: Two-side algorithm is much slower
70 sites → ≈ 1 min.
Sofsem 11 (2011/01/27) Mixed Labeling 26 / 29
Page 42
Experimental Results: Quality of produced illustrations
Low Density 1/10 High Density 1/6
• X-axis: Number of points
• Y -axis: Quality in terms of the number of internal labels
Sofsem 11 (2011/01/27) Mixed Labeling 27 / 29
Page 43
Open Problems
• Our algorithms are mostly subexponential.
[ There is large space for improvements ]
Future Directions:
• Labels occupy two adjacent or four sides of R.
• Extension from type-opo leaders to more appealing type-po (or octilinear)
• Leaders only when they are bend-less.
• Leader length restrictions.
Sofsem 11 (2011/01/27) Mixed Labeling 28 / 29
Page 44
The End
Thank you...
Sofsem 11 (2011/01/27) Mixed Labeling 29 / 29