39
Lecture 11

Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Lecture 11

Page 2: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Matching

A set of edges which do not share a vertex is a matching.

Application: Wireless Networks may consist of nodes with single radios, no interference constraint

A set of links can be scheduled only if the set is a matching

Page 3: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Input Queued Switches

The links scheduled must be a matching

Page 4: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Maximum Matching

Matching of largest cardinality

Augmenting path is a path of alternating sequence of matched and unmatched edges with free end nodes.

A node is free if none of its incident edges is in a matching.

e1 e2 e3

Size of matching increases if {e2} is replaced by {e1, e3}

Page 5: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

A B = (A – B) (B – A)

Suppose M is a matching and P is an augmenting path.

Then M P is also a matching

A matching is maximum if and only if there is no augmenting path.

Also, |M P | = |M| + 1

If there is no augmenting path, then the matching is not maximum.

Page 6: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Let there be a matching M` of greater cardinality than M.

Consider the graph M M’

Clearly, a vertex can have at most 2 incident edges

So the new graph consists of disjoint paths and cycles.

The cycles must be even cycles with alternating edges from M and M’

A vertex can have one incident edge from M, or one incident edge from M’, or one incident edge from M and another from M’

Page 7: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Paths will also have edges altering between M and M’

Since M’ has a cardinality greater than M, there must be at least one path which starts and ends in M’.

This is an augmenting path for M.

Page 8: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Maximum Matching Algorithm

Start with an empty set.

1) Search for an augmenting path.

If there is an augmenting path, then update the matching, else terminate.

Go to (1)

How does one find an augmenting path?

Page 9: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Bipartite Graph

Augmenting path can be found by Hungarian tree method

Breadth first search like method

Consider one of the two partitions S.

S TStart from the free vertices in S

All the edges from the free vertices are in the tree.

Page 10: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

S TStart from the free vertices in S

All the edges from the free vertices are in the tree.

If we happen to reach a free vertex in T, then we have found an augmenting path.

Suppose all the vertices in T are matched, then we follow the matched edges back to S, and subsequently all free edges from the newly encountered ones in S.

If we reach a free vertex in T we are done, otherwise again follow back the matched edges into S.

Page 11: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

We would never reach the same vertices in S anyway.

Vertices in S are either matched or free.

We take only matched edges to reach S from T.

A matched edge can not reach a free vertex.

A matched edge can not reach an already reached matched vertex, because it has been reached using a different matched edge.

Don’t include free edges from S into already reached vertices in T.

So vertices in T are never repeated

Page 12: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Hungarian tree search finishes in O(E)

Page 13: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Is it possible that there is an augmenting path, but the Hungarian tree does not yield one?

An augmenting path has odd length.

Any odd length path must have one end in S and another end in T.

An augmenting path must have one free vertex in S and another in T.

Consider an augmenting path from the free vertex in S.

Page 14: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

The first edge is from a free vertex in S.

The second edge is a matched edge from T.

The third edge is a free edge from S.

The fourth is a matched edge from T….

We are looking at all such paths in the Hungarian method.

If there is an augmenting path, we would find one!

Page 15: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Complexity Analysis

Once an augmenting path is found, one new vertex is matched.

Need to look for augmenting paths at most V times.

Looking for an augmenting path consume O(E).

So, overall O(VE).

Page 16: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Nonbipartite Graph

Basic algorithm remains same.

Need to find augmenting paths in different ways.

We can not partition the vertex set into two sets, and start with free vertices in just one set.

As a result need to consider all free vertices.

You may clearly reach some free vertex in your search because an augmenting path ends in a free vertex.

Page 17: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

But reaching a free vertex does not mean that we have reached an augmenting path.

So we can not rule out reaching free vertices (as an augmenting path starts and ends in a free vertex). At the same time when we reach a free vertex, we do not know whether we have an augmenting path or not!

Odd cycles are the problems.

Page 18: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

So for nonbipartite graphs, we start from a single free vertex at a time.

Also, whenever odd cycles are detected they are shrunk into one vertex, called blossoms.

After discovering augmenting paths, the blossoms are expanded.

Need an O(V4) algorithm.

Page 19: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Weighted Matching

Now, every edge has a weight.

Weight of a matching is the sum of the weights of its edges.

Need to find a maximum weighted matching.

More general case of maximum matching (maximum matching is maximum weighted matching with edge weight 1)

Page 20: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

ApplicationWireless networks with only constraints on the number of radios.

Any set of edges scheduled is a matching.

Throughput optimal policy calls for scheduling the matching with maximum backlog difference.

Consider the weight of an edge as the difference between its source and destination backlog.

We need to find a maximum weighted matching every step.

Page 21: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Is it sufficiently general to consider a graph with nonnegative weights?

Is it sufficiently general to consider complete graphs? (A complete graph is one where there is an edge between every pair of vertices).

For bipartite graphs, is it sufficient to consider equal size partitions only.

Page 22: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Bipartite Graphs

Will consider bipartite graphs.

Partitions are X and Y and |X| = |Y|

We assume that there is always an edge between vertex x in partition X, and vertex y in partition Y.

Every edge has a nonnegative weight.

A matching where every vertex is matched is a perfect matching.

Such a bipartite graph has a perfect matching.

Page 23: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Vertex LabellingWe assign a nonnegative real number with each vertex. This nonnegative real number is the label of the vertex.

Label of vertex x is l(x).

A label is feasible if for every edge (x, y),l(x) + l(y) w(x, y)

An example of a feasible label is l(y) = 0 for all vertices in Y and l(x) = maxyw(x, y)

l(x) + l(y) = maxyw(x, y) w(x, y)

Page 24: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Equality Subgraph

Equality subgraph consists of all vertices. An edge (x, y) is included in the equality subgraph if l(x) + l(y) = w(x, y).

If the equality subgraph Gl has a perfect matching M, then M is the maximum weighted matching in the original graph G.

Weight of M = eM w(e)

= u, : u, is matched l(u) (since M is a matching and Gl is an equality subgraph) = u, : u, is in V l(u) (since M is a perfect

matching)

Page 25: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Consider any other matching M in the graph G.

Weight of M = eM w(e)

u, : u, is matched l(u) (since M is matching)

u, : u, is in V l(u) (since labels are nonnegative)

= Weight of M

So, if we can adjust the labels so that the equality subgraph has a perfect matching, then we are done. Why?

Page 26: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

If a perfect matching exists, then it is the maximum matching.

So, existence of a perfect matching can be tested by computing the maximum matching in the equality subgraph.

Supposing, the equality subgraph had all the edges in the original graph.

Then it is a complete bipartite graph.

Hence, it would have a perfect matching.

Page 27: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

So, if the equality subgraph does not have a perfect matching, we should adjust the labels so that the number of edges in the equality subgraph increases.

However, any adjustment should be such that the labels are feasible.

Adjustment should aim at satisfying equality constraints in the edges.

Page 28: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Maximum Weighted Matching Algorithm

Start with the following labels:

l(y) = 0 for all vertices in Y and l(x) = maxyw(x, y)

2. Construct the equality subgraph.

Find a maximum matching in the equality subgraph.

If this is a perfect matching, then stop. Otherwise, readjust the labels and go to step (2).

Page 29: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Readjustment of Labels

Construct the Hungarian tree w.r.t. the current maximum matching in the equality subgraph.

Let S be the set of vertices in X in the tree, and T be the set of vertices in Y.

Start from the free vertices in X.

Free vertices exist since the matching is not perfect.

The hungarian tree will not yield an augmenting path in the equality subgraph.

Page 30: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Observe that there are no edges between S and Y – T in the equality subgraph (else hungarian tree has not been grown properly).

At the same time, there are edges between S and Y – T in the original graph.

Reason: Current matching is not maximum in G, as G has a perfect matching, and this is not a perfect matching.

So the hungarian tree must have an augmenting path in G.

But we know there is no augmenting path in the current hungarian tree.

This means that the current hungarian tree can grow further in G, and this is possible only if there are edges between S and Y-T.

Page 31: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Decrease the labels in S uniformly, and increase those in T uniformly so that the labels are valid.

Edges between S and Y-T in G will now start entering the equality subgraph.

Stop when the first edge enters.

A new vertex in Y is added to the Hungarian tree.

If this vertex is free we have an augmenting path, otherwise the Hungarian tree grows.

Page 32: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

If this vertex is free, stop the relabelling and go to step (2).

Otherwise, relabel once again.

Hungarian tree can not grow indefinitely.

So we always improve the matching before going to step (2).

Now, we improve the matching till we find a perfect matching in the equality subgraph.

Page 33: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Input Queueing

The switch can transport at most one packet between any input and output in any slot.

1

2

34

5

A

B

C

D

E

There can be a packet transmission between 1-A, 2-B, 3-D in one slot.

But 1-A, 2-A transmissions can not take place simultaneously, nor 1-A 1-C.

Page 34: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Activation schedule needs to be a matching in every slot.

HOL Blocking:

Every input line maintains a single queue. Only the first packet in any queue can be scheduled (head of line packet).

It was shown that even if inputs always have packets, an input or output line can not be utilized more than 58.5%

Karol et. al. , 1988, JSAC

Now let the head of line packet of line 1 be intended for A, the second packet of line 1 is intended for B, head of line packet of line 2 is intended for B.

In this case, either line 1 or line 2 would be idle.

Page 35: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Look ahead scheduling:

It is allowed to schedule packets other than HOL, look upto second or third packets….

Improvement of Throughput

Achieving 100 % Throughput in Input Queued Switches

N. Mckeown, V. Annantharam, J. Walrand, INFOCOM 96

Page 36: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Consider an N x N input queued switch

Every input maintains N separate queues, one for each output.

In all, there are N2 queues at the input.

The scheduled queues should be a matching, since no two scheduled queues must share an input or an output node.

Weight of a queue is the number of packets in the queue.

Schedule the queues to form a maximum weighted matching.

Incidentally, queues form a complete bipartite graph.

Page 37: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Stability Results

Suppose, arrival process for any input output pair is i.i.d.

Also, arrival processes for different input output pairs are independent.

Probability of a packet arrival in a slot for input output (u, v) is puv.

Let u puv 1 and v puv 1

Then the system is stable under the above policy.

Page 38: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Resource allocation constraints in input queued switches and single hop wireless networks are fundamentally similar.

Consider a system of wireless nodes.

Single hop transmission.

Every node has a single radio.

No interference constraint.

Collision can be avoided if scheduled links are matchings.

Studied by Tassiulas and Ephremidis in Automatic Control, 1992.

Page 39: Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,

Weight of a link = difference in backlog across the link

Difference in backlog in this case is number of packets waiting at the source of a link.

Throughput optimum policy schedules the matching with maximum difference in backlog (maximum weighted matching).