building mst with Õ(n) bits of communication in a distributed network building mst with Õ(n) bits...

35
Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King, University of Victoria Joint work with Mikkel Thorup and Shay Kutten

Upload: osborn-stewart

Post on 19-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Building MST with Õ(n) bits of communication in a Distributed Network

1

Valerie King, University of VictoriaJoint work with Mikkel Thorup and Shay Kutten

Page 2: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Network with n nodes, m edges Each node has local info: incident edges, wts,neighbors’ IDs Nodes have distinct IDs in [1,…,nc]

G

F

C

D EA

CONGEST model

Page 3: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Communication: Each node may send (different) messages of size O(log n ) to all its neighbors in a single step. Synchronous vs. Asynchronous

F

C

D EA

Page 4: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

A network maintains a subgraph if its edges are marked by their

endpoints

J

H

G

F

C

D EA

Page 5: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

ST (or MST) Problem: Build a tree or MST

G

F

C

D EA

Page 6: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Classic Result:1983: MST with O(m + nlogn)

messages

Gallager, Humblet and Spira (JACM)

• asychronous• works if starting with any number of nodes

wake• time O(n2), or O(n log n) if all nodes wake at

start

Page 7: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

“Folk Theorem” Auerbuch, Goldreich, Peleg, Vainish( JACM 1990)

“If each proc knows only its ID and the IDs of its neighbors, then flooding is the best that can be done”

Page 8: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Auerbuch, Goldreich, Peleg, Vainish( JACM 1990)show:

Constructing a spanning tree requires Ω(m) messages

Even if• synchronous• nodes are all awake at the start• alg is Monte Carlo• nodes know the IDs of their immediate

neighbour• nodes know n, size of the network

Page 9: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Provided…

Constructing a spanning tree requires Ω(m) messages

Even if• synchronous• nodes are all awake at the start• alg is Monte Carlo• nodes know the IDs of their immediate

neighbour• nodes know the size of the network

• Provided IDs can only be compared

Page 10: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Without proviso, they show

Constructing a spanning tree requires Ω(m) messages

Even if• synchronous• nodes are all awake at the start

• alg is deterministic• the nodes know the IDs of their immediate

neighbour• nodes know the size of the network

• ID space is super poly

Page 11: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Another Lower BoundKutten, Pandurangan, Peleg, Robinson, Trehan (PODC2013)

Constructing a tree requires Ω(m) messages

Even if• synchronous• nodes are all initialized at the start• alg is Monte Carlo • nodes do not know the IDs of their

immediate neighbours• nodes know the size of the network

Page 12: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

This workAn MST can be constructed in Õ(n) bits of communication and time (and O(log n) bits space per node) if • synchronous • the nodes are all initialized at the start• the alg is Monte Carlo • nodes know the IDs of their

immediate neighbours• nodes know n ?• Using operations which combine IDs.

Page 13: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

The algorithm

Boruvka style parallel alg with lg n phases:• In each phase, w.h.p. each component finds

the lightest edge incident to it and merges.• Communications, Time of phase ~Õ(n)• Start a new phase only after time to finish

processing the largest cluster has passed.• End when no progress after log n tries

Page 14: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Basic problem:find edge leaving a marked tree

in a marked forest

G

F

C

D EA

Page 15: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Also solves MST updating problemPrevious method requires lots of memory

O(n) amortized messages per updateAwerbuch, Cidon, Kutten:1990, 2008

Local memory=O(n* degree of node*logn)(Each node stores a belief about each neighbor’s version of the forest (!))

Here we use only O(log n) local memory

Page 16: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Ideas came from

• Dynamic Connectivity data structure Kapron, King, Mountjoy 2013

• Graph Sketching Ahn, Guha, McGregor 2012• Sitting in Simons Institute

Page 17: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

ideas from that work

1. Σ v in C deg(v) mod 2

= Σ e in ( C, V\C) deg(v) mod 2

because edges with both endpoints in C contribute 0. 2. If edges randomly sampled

Pr( Σ deg(v) mod 2 =1) = ½ iff (C,V\C) is nonempty

Else it’s always 0.3. XOR of edge names = name of edge leaving if there is exactly 1(Note: Edge name {u,v}=(u,v) iff u<v)

Page 18: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

We use: basic communication step:broadcast-and-echo over known tree edges

J

H

G

F

C

D EA

Page 19: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

We use: basic communication step:broadcast-and-echo over tree edges

J

H

G

F

C

D EA

Leader node sends to whole tree, Response composed from leaves back up to leader

Page 20: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

• Find any edge leaving a componentuses O(1) expected broadcast-and echoes

• Find min-weight edge leaving a componentuses O(log n/loglog n) expected broadcast-and-echoes

Page 21: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Find Any: Parallel search packed in one word

• U ={edges}• Leader randomly chooses h, a 2-wise indep hash

h : U U

• Each node v computes b(v)= b 1 b 2 … b log n

bi(v) =| {(u,v) s. t. h(u,v) ≤ 2i}| mod 2

e.g. parity of hashed values in each range.

Hashed values

1 2 4

Page 22: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Find Any (cont’d):

1. XOR the b(v) over nodes v in tree

2. min first i ≠0

3. XOR names of edges incident to all v in tree with

h(edge) ≤ 2min

4. With constant prob, there is exactly one such edge which is leaving.

XOR =Name of edge leaving

Page 23: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Findmin weight edge leaving

Two Tests to see if there is an edge leaving a comp:

1. Constant prob. Test out: 1 broadcast, 1 1-bit echo2. High prob. HP-Test out: 1 broadcast, 1 log n-bit

echo

Page 24: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Findmin weight edge leaving

1. In parallel, with 1 Broadcast-and-echo

do log n-wise search on weights with

TestOut ‘s to find smallest wt interval

2. Verify its minimality with HP TestOut

3. Repeat if wrong or recurse on that interval

Page 25: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Testout

randomly choose a function F: edges{0,1}

s.t. for a nonempty set S, w. constant prob. >0, an ODD number of S’s elements map to 1.

Page 26: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Simple F (Thorup)

F has two parts,• a 2-wise indep.hash function

h: U U• t, a random element of U

F(s)=1 iff h(s) < t

F can be described in O(log |U|) bits.

Page 27: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Why it works

• h hashes UU, S subset of U• Imagine 2|S| equal sized intervals.

Exactly one x in I, in middle third

t lands in some I, in top third or bottom third

Page 28: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

HP TestOut

• Repeat Testout in parallel O(log n) times to get prob error 1/nc ?

• Would need to send clog n hash functions

Or use deterministic amplification

Or…

Page 29: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Test 2: Set equality method to get HP-TestOut

A tree T is maximal iff

the set Out(T) of edges leaving all nodes in T

= the set In(T) of edges entering all nodes

in T

Page 30: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Test equality of two sets usingpolynomial ID-testing

O(log n) bits of communication

f(x)=Πa in Out (x-a)

g(x)=Πb in In (x-b)

Does f(x)=g(x)?

(Schwartz-Zippel):

Set x=random α in Zp, p be a prime, p > nc+2

compute over Zp:

Pr(f(α)-g(α))=0 if In ≠ Out

= Pr [α= root]

= #roots/p< n2 / p = 1/nc

Page 31: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Implementation (1 broadcast-and-echo)

• Leader broadcasts α

• Each node v computes fv(α) and gv(α) for its incident edges

• Starting at the leaves, pass to parent

fv(α) * πc fc(α), c child of v

g is computed similarly• Leader (root) computes f-g.

– If 0, Testout is true, else false.

Page 32: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

In short

• build an MST in O(n log2 n/loglog n) messages and time.

• Can we build a ST in O(n log n) messages and time?

• repair an ST in O(n) expected message• repair an MST in O(n log/log log n)

messages w.h.p.

All using local memory O(log n)

Page 33: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Open problem and discussion

• Is Ω(m) communication required for building MST in asynchronous model?

• Lower bound for findmin• Time v. communication tradeoffs• Applications to map reduce etc.

• Thank you

Page 34: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

Open problem and discussion

• Is Ω(m) communication required for building MST in asynchronous model?

• Lower bound for findmin• Time v. communication tradeoffs• Applications to map reduce etc.

• Thank you

Page 35: Building MST with Õ(n) bits of communication in a Distributed Network Building MST with Õ(n) bits of communication in a Distributed Network 1 Valerie King,

“Impromptu”=Only local info maintained by

node betw updates

J

H

G

F

C

D EA