Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for...

56
Fractional Cascading Fractional Cascading CSE737 2002

Transcript of Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for...

Page 1: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Fractional CascadingFractional Cascading

CSE737

2002

Page 2: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

What is What is Fractional CascadingFractional Cascading anyway? 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]

Page 3: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Iterative SearchingIterative Searching

Graph where vertices have lists associated.

Page 4: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Iterative SearchingIterative Searching

Graph where vertices have lists associated.

2, 44, 78, 234…

Page 5: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Iterative SearchingIterative Searching

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

Page 6: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Iterative SearchingIterative Searching

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

Page 7: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Iterative SearchingIterative Searching

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

Page 8: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Iterative SearchingIterative Searching

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

Page 9: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Example of Iterative Searching: OnionExample of Iterative Searching: Onion

Find what layer a point lies on.

a

b

c

de

f

Page 10: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Example of Iterative Searching: OnionExample of Iterative Searching: Onion

Find what layer a point lies on.

a

b

c

de

f d

b f

a c e

Associated graph (binary tree)

Page 11: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Example of Iterative Searching: OnionExample of Iterative Searching: Onion

Find what layer a point lies on.

a

b

c

de

f d

b f

a c e

Search in the list associated to each vertex

Page 12: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Example of Iterative Searching: OnionExample of Iterative Searching: Onion

Find what layer a point lies on.

a

b

c

de

f d

b f

a c e

Search in the list associated to each vertex

Page 13: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Example of Iterative Searching: OnionExample of Iterative Searching: Onion

Find what layer a point lies on.

a

b

c

de

f d

b f

a c e

Query path along the graph

Page 14: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Some definitions [CG] Some definitions [CG] (1 of 16)(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.

Page 15: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Some definitions [CG] Some definitions [CG] (2 of 2)(2 of 2)

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.

vertexedge

catalog

value in catalog

Example of a catalog graph:

Page 16: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

CatalogCatalog

a

b

c

de

f d

b f

a c e

Page 17: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

CatalogCatalog

b

d

b f

a c e

Page 18: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

CatalogCatalog

b

b2

b3

b4

b5

b6

b1

d

b f

a c erecords

Page 19: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

CatalogCatalog

b

d

b f

a c e

b: b1.key, b2.key, b3.key…

Catalog

b2

b3

b4

b5

b6

b1

Page 20: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

CatalogCatalog

b

d

b f

a c e

b: b1.key, b2.key, b3.key…

Catalog

b2

b3

b4

b5

b6

b1 key

Page 21: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

CatalogCatalog

b

d

b f

a c e

b: b0.key, b1.key… b0.key

Catalog (+ Range endpoints)

b2

b3

b4

b5

b6

b1b1

b0

Page 22: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

UsageUsageUsing 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.

Page 23: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

More definitions [CG] More definitions [CG] (1 of 4)(1 of 4)

Augmented catalog: a catalog enlarged with additional records.

Page 24: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Augmented CatalogAugmented Catalog

a

b

c

de

f d

b f

a c e

Page 25: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Augmented CatalogAugmented Catalog

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

b0 c0

Page 26: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Augmented CatalogAugmented Catalog

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

b0 c0

Page 27: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Augmented CatalogAugmented Catalog

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

c3’

b0 c0

Page 28: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Augmented CatalogAugmented Catalog

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

c3’

c6’

b0 c0

Page 29: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Augmented CatalogAugmented Catalog

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

c3’

c6’

b: b1, b2, c3’, b3…

Augmented Catalog

b0 c0

Page 30: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

More definitions [CG] More definitions [CG] (2 of 4)(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.

Page 31: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

BridgeBridge

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

c3’

c6’

b0 c0

Page 32: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

More definitions [CG] More definitions [CG] (3 of 4)(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.

Page 33: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

GapGap

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

c3’

c6’

b0 c0

Page 34: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

GapGap

b

cd

b f

a c eb2

b3

b4

b5

b6

b1

c1

c2

c3

c4

c5

c6

c7

c3’

c6’

Size=|{b3, b4, c4, c5}|=4

Gap

b0 c0

Page 35: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

More definitions [CG] More definitions [CG] (4 of 4)(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.

Page 36: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Answering a query [CG]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.

Page 37: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Page 38: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Add range endpoints

Page 39: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Augment catalogs

Page 40: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Augment catalogs

Page 41: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Augment catalogs

Page 42: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Set bridges

Page 43: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 44: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 45: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 46: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 47: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 48: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 49: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 50: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Multiple Look-Up Query Multiple Look-Up Query

a

b

c

de

f d

b f

a c e

Query

Page 51: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Complexity [CG]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.

Page 52: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Star trees [CG]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.

e1

e2

e3

e4

e5

e6e7

e8

e9

e10

1

2

3

45

e1e2

e3e4

e5

e6

e7

e8

e9e10

Vertex with 10 edges: Star tree with 10 leaves:

Page 53: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Gateways [CG]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.

Page 54: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

Contributions of YZ paperContributions 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 well-known advantages for I/O efficient algorithms.

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

Page 55: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

•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.

Applications [CG]Applications [CG]

Page 56: Fractional Cascading CSE737 2002. What is Fractional Cascading anyway? An efficient strategy for dealing with iterative searches that achieves optimal.

More definitions [CG] More definitions [CG] (2 of 2)(2 of 2)

vertex in the graph

edge in the graph

augmented catalog

old value in catalog

Example of a graph with augmented catalogs:

new value in catalog

bridge

gap