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

Download Report

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

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, no interference constraint
A set of links can be scheduled only if the set is a matching
Input Queued Switches
The links scheduled must be a matching
Maximum Matching
Matching of largest cardinality
A node is free if none of its incident edges is in a matching.
Augmenting path is a path of alternating sequence of matched
and unmatched edges with free end nodes.
e1
e2
e3
Size of matching increases if {e2} is replaced by {e1, e3}
A  B = (A – B)  (B – A)
Suppose M is a matching and P is an augmenting path.
Then M  P is also a matching
Also, |M  P | = |M| + 1
A matching is maximum if and only if there is no
augmenting path.
If there is no augmenting path, then the matching is not
maximum.
Let there be a matching M` of greater cardinality than M.
Consider the graph M  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’
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’
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.
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?
Bipartite Graph
Augmenting path can be found by Hungarian
tree method
Breadth first search like method
Consider one of the two partitions S.
T
S
Start from the free vertices in S
All the edges from the free
vertices are in the tree.
S
T
Start 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.
Don’t include free edges from S into already reached vertices in T.
So vertices in T are never repeated
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.
Hungarian tree search finishes in O(E)
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.
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!
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).
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.
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.
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.
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)
Application
Wireless 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.
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.
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.
Vertex Labelling
We 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)
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 = eM w(e)
= u, : u, is
 is a matching
l(u)
(since
M
matched
and Gl is an equality
subgraph)
= u, : u, is in V l(u) (since M is a perfect
matching)
Consider any other matching M in the graph G.
Weight of M = eM w(e)
u, : u, is
matched
u, : u, is
in V
l(u) (since M is matching)
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?
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.
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.
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).
Readjustment of Labels
Construct the Hungarian tree w.r.t. the current
maximum matching in the equality subgraph.
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.
Let S be the set of vertices in X in the tree, and T be
the set of vertices in Y.
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.
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.
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.
Input Queueing
A
1
B
2
3
C
D
4
E
5
The switch can transport at most one packet between any input and
output in any slot.
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.
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).
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.
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
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
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.
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.
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.
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).