Fractional Cascading CSE737 2002

advertisement

Fractional Cascading

CSE737

2002

What is

Fractional Cascading

anyway?

An efficient strategy for dealing with iterative searches that achieves optimal time in linear space. [“Fractional

Cascading”, Chazelle & Guibas, Algorithmica, 1986]

An efficient strategy for solving the multiple look-up

query problems. [“Yet Another Look at Fractional

Cascading. B-graphs with Application to Point

Location”, Yap & Zhu, CCCG, 2001]

• A technique to reduce the query time in the case of

many 1-dimensional searches with the same range by using the result of one search to speed up other searches. [dBvKOS]

Iterative Searching

Graph where vertices have lists associated.

Iterative Searching

Graph where vertices have lists associated.

2, 44, 78, 234…

Iterative Searching

Graph where vertices have lists associated. Do a search in lists associated with vertices along a path in the graph.

Iterative Searching

Graph where vertices have lists associated. Do a search in lists associated with vertices along a path in the graph.

Iterative Searching

Graph where vertices have lists associated. Do a search in lists associated with vertices along a path in the graph.

Iterative Searching

Graph where vertices have lists associated. Do a search in lists associated with vertices along a path in the graph.

Example of Iterative Searching: Onion f

Find what layer a point lies on.

c e d b a

Example of Iterative Searching: Onion f

Find what layer a point lies on.

c e d b d b f a c e

Associated graph

(binary tree) a

Example of Iterative Searching: Onion f

Find what layer a point lies on.

c e d b a d b f a c e

Search in the list associated to each vertex

Example of Iterative Searching: Onion f

Find what layer a point lies on.

c e d b a d b f a c e

Search in the list associated to each vertex

Example of Iterative Searching: Onion f

Find what layer a point lies on.

c e d b d b f a c e

Query path along the graph a

Some definitions [CG]

(1 of 16)

Catalog: an ordered collection of records with values, stored in non-decreasing order of the value. Values can be repeated inside a catalog, and a catalog contains at least values –

 and

.

Range: an interval of the form [x,y], [x,+

], [-

,y], specified by the two endpoints. For most problems this is [-

, +

], and can be dropped altogether.

Catalog graph: an undirected and connected graph, with one catalog at each vertex and several ranges at each edge. Ranges are specified as pairs of values from the catalogs associated with the vertices joined by the associated edge.

Some definitions [CG]

(2 of 2)

Example of a catalog graph: value in catalog catalog edge vertex

Multiple lookup query: a pair (x,p), where x is the key value and p the search path such that value x falls within the range of all edges on the path p.

f e d

Catalog c a b d b f a c e

Catalog b d b f a c e

Catalog records b

3 b

4 b

2 b b

1 b

6 b

5 d b f a c e

Catalog

Catalog b: b

1

.key, b

2

.key, b

3

.key… b

2 b b

3 b

1 b

4 b

6 b

5 d b f a c e

Catalog

Catalog b: b

1

.key, b

2

.key, b

3

.key… b

2 b b

3 b

4 b

1 key b

6 d b f a c e b

5

Catalog

Catalog (+ Range endpoints) b: b

0

.key, b

1

.key… b

0

.key

b

2 b b

3 b

0 b

4 b

6 b

5 d b f a c e

Usage

Using these concepts, the iterative search problem can be reformulated as looking up a key in the catalogs associated with each vertex along the path.

The goal is to construct a data structure such that:

1) Somehow each pair of neighboring catalogs is correlated so a search in one aids a search in the other.

2) The storage space is still linear.

More definitions [CG]

(1 of 4)

Augmented catalog: a catalog enlarged with additional records.

f e d

Augmented Catalog c a b d b f a c e

Augmented Catalog c

5 c

4 b

3 b

4 c

3 b

2 b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

Augmented Catalog c

5 c

4 b

3 b

4 c

3 b

2 b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

Augmented Catalog c

5 c

4 b

3 b

4 c

3 c

3

’ b

2 b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

Augmented Catalog c

5 c

4 b

3 b

4 c

3 c

3

’ b

2 c

6

’ b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

Augmented Catalog

Augmented Catalog b: b

1

, b

2

, c

3

’, b

3

… c

4 c

5 b

3 b

4 c

3 c

3

’ b

2 c

6

’ b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

More definitions [CG]

(2 of 4)

Augmented catalog: a catalog enlarged with additional records.

Bridge: a record in an augmented catalog pointing to a record with the same value in a neighboring augmented catalog.

Bridge c

5 c

4 b

3 b

4 c

3 c

3

’ b

2 c

6

’ b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

More definitions [CG]

(3 of 4)

Augmented catalog: a catalog enlarged with additional records.

Bridge: a record in an augmented catalog pointing to a record with the same value in a neighboring augmented catalog.

Gap: a pair of consecutive bridges associated with an edge. To ensure the time bound, gaps have sizes less than 6d-1, where d is the (locally bounded) degree of the graph.

Gap c

5 c

4 b

3 b

4 c

3 c

3

’ b

2 c

6

’ b

5 c c

2 b b

0 b

6 b

1 c

0 c

1 c

7 c

6 d b f a c e

Gap

Size=|{b

3

, b

4

, c

4

, c

5

}|=4 c

3 c

4 c

3

’ b

2 b

3 c

5

Gap c b b

0 b

6 b

1 c

0 c

1 b

4 c

2 c

6

’ b

5 c

7 c

6 d b f a c e

More definitions [CG]

(4 of 4)

Augmented catalog: a catalog enlarged with additional records.

Bridge: a record in an augmented catalog pointing to a record with the same value in a neighboring augmented catalog.

Gap: a pair of consecutive bridges associated with an edge. To ensure the time bound, gaps have sizes less than 6d-1, where d is the (locally bounded) degree of the graph.

Specifically, augmenting a catalog is adding records with values present in neighboring catalogs, such that bridges from them have records with the same value on both sides.

Answering a query [CG]

If we know the position of a value in an augmented catalog, we can compute its position in the original catalog in one step.

If we know the position of a value in an augmented catalog, we can compute the position of that value in a

neighboring augmented catalog in O(d) time, where d is the degree of the vertex.

Summarizing, we can handle any multiple lookup query provided that the structures has already been built and

efficient searching is possible for the first augmented catalog that is considered.

f e d

Multiple Look-Up Query c a b d b f a c e

f e d

Multiple Look-Up Query

Add range endpoints c b d b f a c e a

f e d

Multiple Look-Up Query

Augment catalogs c b d b f a c e a

f e d

Multiple Look-Up Query

Augment catalogs c b d b f a c e a

f e d

Multiple Look-Up Query

Augment catalogs c b d b f a c e a

f e d

Multiple Look-Up Query

Set bridges c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

f e d

Multiple Look-Up Query

Query c b d b f a c e a

Complexity [CG]

For a graph of size s and degree d it is possible to construct a data structure to solve the iterative search problem in O(s) space and O(ds) time.

The time bound can be improved using star trees to construct an emulation graph, thus decreasing the degree of any vertex to 3.

The new bound is O(p log d + log s), where p is the length of the search path.

Star trees [CG]

A star tree Tn is an oriented tree with n leaves, endowed with a special vertex: its center. Tn can be obtained from Tn-1 by adding 2 new edges to the leaf closest to the center. Star trees are used here to replace vertices and to ensure that the final degree of the graph is minimal.

Vertex with 10 edges: e1 e10 e2 e3 e9 e4 e8 e5 e6 e7

Star tree with 10 leaves: e7 e4 e3 e10 e9

5

4

2 e1

1 e6

3 e2 e8 e5

Gateways [CG]

To get the search started, we would have to keep a copy of all augmented catalogs in a table, and perform the first search in one of them. To avoid this, we introduce

gateways, vertices that have augmented catalogs attached to them, but no catalogs per se. Processing the new nodes yields paths consisting of transit edges and

transit vertices.

The new structure closely resembles a B-tree.

The difference is that splitting and merging gaps may result in coming back to a node previously visited, and go on for an unpredictable length of time.

Contributions of YZ paper

In practice catalog graphs are usually trees (directed, acyclic…). Reformulate catalog graphs as catalog

DAGs.

Relax bridges into semi-bridges (unidirectional pointers): easier to maintain and more space-efficient.

• In Chazelle & Guibas the query path is ‘magically’ built. Yap & Zhu introduce edge types and discriminant functions to build the query path.

• Introduce B-graphs as counterparts to catalog DAGs and true generalization of B-trees, inheriting their wellknown advantages for I/O efficient algorithms.

• Generalize the point location algorithm for line segments to monotone chains.

Applications [CG]

Explicit iterative search.

• Intersecting a polygonal path with a line (using convex hulls).

• Slanted range search (points inside a trapezoid).

• Orthogonal range search.

• Orthogonal range search in the past.

Computing locus-functions.

Space compression of data structures.

• Iterative search extensions of query problems.

More definitions [CG]

(2 of 2)

Example of a graph with augmented catalogs: gap bridge new value in catalog old value in catalog augmented catalog vertex in the graph edge in the graph

Download