schematization of networks

39
1 Schematization of Networks Rida Sadek

Upload: edric

Post on 11-Jan-2016

19 views

Category:

Documents


0 download

DESCRIPTION

Schematization of Networks. Rida Sadek. This talk discusses:. An algorithm that is studied in the following papers: S. Cabello, M. de Berg, and M. van Kreveld. Schematization of networks . Computational Geometry: Theory and Applications 30: 223–238 (2005). Overview. Introduction - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Schematization of Networks

1

Schematization of Networks

Rida Sadek

Page 2: Schematization of Networks

2

This talk discusses: An algorithm that is studied in the following

papers: S. Cabello, M. de Berg, and M. van Kreveld.

Schematization of networks. Computational Geometry: Theory and Applications 30: 223–238 (2005).

Page 3: Schematization of Networks

3

Overview

Introduction Algorithm sketch Definitions and concepts needed Details of each part of the algorithm When does the algorithm fails?

Page 4: Schematization of Networks

4

Introduction

We have: railroad or highway map (a network map)

We want: A schematized version of that mapa) Nodes and connections to be displayed in a highly

simplified form.

b) Preserve the approximate layout of the map Preserve recognizability for readers.

Page 5: Schematization of Networks

5

Introduction

Simplification is achieved by displaying the paths as a 2-link or 3-link paths AND links are restricted to certain orientations

Preserving recognizability is achieved by having the output map EQUIVALENT to the input map.

Page 6: Schematization of Networks

6

Algorithm Input and Output

Input: A planar embedding of a graph consisting of polygonal paths between specified points called endpoints.

Output: Another planar embedding where all endpoints have the same positions AND every path is either a 2-link or 3-link path where links are restricted to certain orientations.

Page 7: Schematization of Networks

7

Algorithm Sketch

1) Extract connections from original map and ORDER them top to bottom in a list.

2) Remove connections from original map but keep endpoints.

3) Place connections: one by one from top to bottom leaving as much

space as possible for later Each newly placed connection must be of the

desired shape and below the previously placed connections

Page 8: Schematization of Networks

8

Terminology

A path is a continuous mapping c: [0,1] R2

Let |c| denotes the complexity of the path c the number of edges it has.

A (polygonal) map M is a set of simple polygonal paths {c1, …, cm} such that two paths do not intersect except at shared endpoints.

A monotone map is a map where all paths are x-monotone.

We denote by PM the set of endpoints {c(0), c(1) | c Є M}

Page 9: Schematization of Networks

9

Definitions and Concepts

Equivalence: (intuitively) 2 maps are equivalent if all paths can be transformed from one map to the other in a continuous way, fixing the endpoints and without crossing any “important points”. Important points of a path c are the endpoints of the other

paths. Algorithm can be adapted to take additional “important

points”. In terms of the algorithm, the algorithm should keep

the face structure on both embeddings (input and output) The cyclic order of paths around endpoints is maintained.

Page 10: Schematization of Networks

10

Definitions and Concepts

Equivalence: (formally) Given a set of points P, two paths c and c’ with the same endpoints are equivalent in (R2 \ P) if and only if there exists a continuous function F : [0,1] x [0,1] R2 \ P (minus P because the deformation of the path should not cross any point in P) such that: F(0,t) = c(t) and F(1,t) = c’(t), for all t Є [0,1] (the first path is c, the

final path is c’), F(s,0) = c(0) = c’(0) and F(s,1) = c(1) = c’(1), for all sЄ[0,1] (the

endpoints are fixed). Two maps M = {c1,…,cm} and M’ = {c’1,…,c’m} are equivalent

maps iff for some renumbering of the paths in M’, paths ci and c’i are equivalent in (R2\PM)U {ci(0), ci(1)} for all paths ci Є M

Page 11: Schematization of Networks

11

Definitions and Concepts

Above-Below relation among paths: Let c be a path.

A point p Є R2 with p not on c is above (below) c if for every equivalent path c’ in R2 \ {p} the intersection of lp- (respectively lp+

) and c’ is nonempty.

A path ci is above cj if ci(0) or ci(1) (one of the endpoints) is above cj, or if cj(0) or cj(1) is below ci.

Page 12: Schematization of Networks

12

Definitions and Concepts

Lemma 1: The above-below relation among paths is an invariant between equivalent maps Proof:

For any point p in R2, equivalent paths in R2\{p} have the same relation with respect to the point p.

Let M and M’ be equivalent maps. And for every ci Є M, let c’i Є M’ be its corresponding path. Since ci and c’i are equivalent in (R2 \ PM) U {ci(0), ci(1)} (with

respect to the endpoints of the paths without their own.) for any endpoint p Є (PM \ {ci(0), ci(1)}) ci and c’i are also

equivalent with respect to p. Any endpoint other than the endpoints of ci have the same

above-below relationship with ci and c’i. the Lemma.

Page 13: Schematization of Networks

13

Canonical Sequence

It is the “thing” that will help us to algorithmically compute the above-below relation and equivalence among paths.

Page 14: Schematization of Networks

14

Canonical Sequence(contd)

Let P be a set of points Let lp- and lp+ be the vertical

rays for all points pЄP For a given path c:

Start walking from c(0) Write the sequence of rays

that are being crossed Stop walking at c(1)

Repeatedly remove adjacent rays that are identical

Result is the canonical sequence of path c with respect to the set of points P

Page 15: Schematization of Networks

15

Canonical Sequence (contd)

If P is only one point p Then: Any path c’ equivalent to

c with respect to P has to cross the rays lp+ or lp- that appear in the canonical sequence of c with respect to {p}.

a point p is below a path c iff lp+ appear in the canonical sequence of c with respect to {p}.

Page 16: Schematization of Networks

16

Canonical Sequence (contd)

Lemma 2: Two paths with the same endpoints have the same canonical sequence with respect to P if and only if they are equivalent in R2\P. Proof: This Lemma is proofed using the concept

of universal cover in a paper titled “Testing Homotopy (equivalence in our terms) for Paths in the Plane”.

Page 17: Schematization of Networks

17

Above-Below Relations in Monotone Maps The same definition we gave before using the

monotonicity becomes: x-monotone path a is above x-monotone path b iff

there are points (x,ya) Є a and (x,yb) Є b with ya>yb.

Page 18: Schematization of Networks

18

Above-Below Relations in Monotone Maps (contd) Facts for a monotone map M:

The above-below relation among paths is acyclic. If a is above b and b above c then c is below a and

below b AND can’t be above a nor b. If M has complexity n, then a total order extending

the above-below relation can be computed in O(nlogn)

Note also that: If a given map M do not admit a partial order

among its paths then no monotone map can be equivalent to M.

Page 19: Schematization of Networks

19

Above-Below Relations in Monotone Maps (contd) Let M = {c1,… ,cm} and M’={c’1,…,c’m} be two

monotone maps such that the paths ci and c’i have the same endpoints. Then, the maps M and M’ are equivalent if and only if they define the same above-below relation.

Page 20: Schematization of Networks

20

Above-Below Relations in Monotone Maps (contd) Proof:

We have already proven the first implication when we said that the above-below relation among paths is an invariant between equivalent maps.

To prove the other implication we will show that if M and M’ are not equivalent then they define a different above-below relation. If ci and c’i are not equivalent in R2\

PM U {ci(0), ci(1)} Then there is a point p in the regions

between the 2 paths in question These regions are well defined

because the paths are x-monotone.

p has a different above-below relation with ci and c’i

AND for any path cj that has p as an endpoint The above-below relation

between cj and ci is different than the above-below relation between c’j and c’i.

Page 21: Schematization of Networks

21

Computing the Order in a map This is done in 3 steps:

Convert the map into a rectified map. Transform the rectified map into a map with

x-monotone pieces. Compute the order on that map.

Page 22: Schematization of Networks

22

Rectified maps

Definition: A set of paths M’ = {c’1,…,c’m} is a rectification of a map M = {c1,… ,cm} if: M’ is a map (its paths only intersect in common

endpoints); the complexity of map M’ is linear in the

complexity of map M; paths c’i are made of axis-aligned segments;

paths ci and cj have the same above-below relation as c’i and c’j .

Page 23: Schematization of Networks

23

How we rectify M?

Decompose each path ci into monotone pieces {ci

1;…; ciki} and the result is

Mmono = {c11,…,c1

k1,…,cm1,…,cm

km}

Mmono has complexity O(n). we can compute a total order extending

the partial order in O(nlogn) (as we have seen before in the facts of the monotone map). This will lead to a rank r for each piece.

Page 24: Schematization of Networks

24

Construction of the rectified map Let ci

j be a piece with left endpoint (px,py), right endpoint (qx, qy), and rank r.

Make the horizontal segment hij =

[px, qx] * r in the rectified map. Path c’i joins hi

1, … , hik by

connecting the endpoints of every two consecutive horizontal segments by a vertical segment

M’ is the collection of these paths {c’1,…,c’m}

Note that an endpoint sharing several paths will be mapped into several points above each other vertically BECAUSE same x but different rank r.

Page 25: Schematization of Networks

25

Time analysis for computation of M’ As per a previous fact that states: If M is

monotone and has complexity n, then a total order extending the above-below relation (or any partial relation) can be computed in O(nlogn)

The work done after that take actually O(n) time since each step takes O(1) time and Mmono has O(n) complexity.

O(nlogn) time in total.

Page 26: Schematization of Networks

26

Computing order using a rectified map In a paper titled “Testing Homotopy (equivalence in

our terms) for Paths in the Plane” an algorithm called rcp (rectified canonical path) is presented.

rcp transforms the path c’i Є M’ (the rectified map) into another path rcp(c’i) with the following properties: rcp(c’i) is equivalent to c’i in (R2 \PM ) U {c’i(0), c’i(1)} |rcp(c’i)| ≤ |c’i|; if c’i and c’j don't intersect, then rcp(c’i) and rcp(c’j) do not

intersect either; rcp(c’i) has the minimum possible number of x-monotone

pieces that any path equivalent to c’i in (R2 \PM ) U {c’i(0), c’i(1)} can have.

Page 27: Schematization of Networks

27

Computing order using a rectified map (contd) Use rcp to get a map N = {rcp(c’1),…,rcp(c’m)} N has the following properties:

It is a map with complexity O(n): M’ has complexity linear to M (by definition) |rcp(c’i)| ≤ |c’i|

N can be constructed in O(nlogn) To make M’ we take O(nlogn) To make N we take O(|M’|log|M’|) and since |M’| is O(n) O(nlogn)

N has the same above-below relation among its paths as M rcp(c’i) is equivalent to c’i (by properties of rcp) ci and cj have the same above-below relation as c’i and c’j (by

definition of rectified maps) N has the same above-below relation as M

Page 28: Schematization of Networks

28

Computing order using a rectified map (contd) Claim: N is monotone if and only if M admits

an equivalent monotone map. Only going to proof that if M admit an

equivalent monotone map then N is monotone

The other implication will not be proven After proving the Claim we can conclude that

we can decide in O(nlogn) time whether an equivalent monotone map exists for M.

Page 29: Schematization of Networks

29

Computing order using a rectified map (contd) Proof:

Recall: An endpoint pЄPM of several paths in M is mapped into several endpoints p’ЄPM’ in M’

By construction, no segment of M’ can pass between 2 points of p’

When considering the canonical sequence of a path c’i with respect to PM’\{c’i(0),c’i(1)} we can treat the set of these p’ points as one point. Let that point be also called p’.

Page 30: Schematization of Networks

30

Computing order using a rectified map (contd) Proof (contd):

This means that IF replace each occurrence of lp+ with lp’

+(same for lp-) in the canonical seq of ci with respect to PM\{ci(0),ci(1)} THEN we get the canonical sequence of c’i with respect to PM’\{c’i(0),c’i(1)}

NOW: IF M admit a monotone equivalent map THEN the canonical seq of

each path ci Є M don’t contain 2 rays emanating from the same point (otherwise there would be a turn point which contradicts the monotone hypotheses)

Canonical seq c’i don’t contain 2 rays emanating from the same point.

By the last property of rcp “rcp(c’i) has the minimum possible number of x-monotone pieces that any path equivalent to c’i in (R2 \PM ) U {c’i(0), c’i(1)} can have” we conclude that rcp(c’i) is x-monotone.

N is monotone.

Page 31: Schematization of Networks

31

Computing order using a rectified map (contd) Finally:

Since the order among paths in M is the same as the order among paths in N

And Since if M admit a monotone equivalent map then N is monotone.

And Since we can compute a total order extending the partial order (above-below) among paths of N in O(nlogn) time (because N is monotone)

THEREFORE we can compute in O(nlogn) time a total order extending the partial order (above-below) among paths of M.

Page 32: Schematization of Networks

32

Recall

The sketch of the algorithm was:

1) Extract connections from original map and ORDER them top to bottom in a list. (DONE)

2) Remove connections from original map but keep endpoints.

3) Place connections one by one leaving as much space as possible for later AND each newly placed connection must be of the desired shape and below the previously placed connections (LEFT to do)

Page 33: Schematization of Networks

33

Placing paths in the schematic map Place paths one by one in

the computed order Place each path as high as

possible. A minimum vertical separation distance can be specified.

Each path is either a 2-link or a 3-link path where each link has a certain direction.

The idea of the algorithm can be applied to any type of schematic connection (variations of 2-link or 3-link).

Page 34: Schematization of Networks

34

Placing paths in the schematic map (contd) We are going to describe the placement algorithm

for the case of 3-link {HDH,VDV} paths that are L2 shortest.

Page 35: Schematization of Networks

35

Placing paths in the schematic map (contd) Idea:

Incrementally place paths from top to bottom respecting the order.

Maintain the lower envelope of the already-placed paths in a balanced binary search tree sorted on x-coordinate.

To add a path: Search with the left and right endpoints and collect the part of

the lower envelope in between. Determine the topmost placement of the new path, with or

without a minimum separation distance. The new path will replace the pieces of the lower envelope we

collected In the tree this is basically: deleting the leaves we collected and

inserting up to 3 leaves (a leaf for each link).

Page 36: Schematization of Networks

36

Placing paths in the schematic map (contd) In the case of {HDH, VDV}-paths, to decide

which kind of path to use, we make use of the endpoints of the path.

Since the path has to be L2 shortest then: Use HDH path when vertical distance between

the endpoints is smaller than the horizontal distance

Otherwise use VDV.

Page 37: Schematization of Networks

37

Placing paths in the schematic map (contd) Time analysis:

Searching with the left and right endpoints in the tree takes O(logn) time.

Updating the tree involves Deletion of k leaves (where k in the number of pieces

the new path is below) Insertion of O(1) leaves (at most 3). This takes O((k+1)logn) time

Since in total O(n) leaves are inserted and each leave is deleted at most once Total time of placing the schematic paths takes O(nlogn) time.

Page 38: Schematization of Networks

38

When does the algorithm fails? It fails in 2 different ways:

When computing the order: It can happen that the

connections cannot be ordered.

When placing the connections: It can happen that we

cannot place the next connection due to the schematic connection chosen

When placing the next path, if an endpoint happens to be above the part of lower envelope we searched for.

Page 39: Schematization of Networks

39

Questions?