Fully dynamic 3/2 approximate maximum cardinality matching in O(√(n)) update time

10/02/2018 ∙ by Manas Jyoti Kashyop, et al. ∙ 0

We present a randomized algorithm to maintain a maximal matching without 3 length augmenting paths in the fully dynamic setting. Consequently, we maintain a 3/2 approximate maximum cardinality matching. Our algorithm takes expected amortized O(√(n)) time where n is the number of vertices in the graph when the update sequence is generated by an oblivious adversary. Over any sequence of t edge insertions and deletions presented by an oblivious adversary, the total update time of our algorithm is O(t√(n)) in expectation and O(t√(n) + n n) with high probability. To the best of our knowledge, our algorithm is the first one to maintain an approximate matching in which all augmenting paths are of length at least 5 in o(√(m)) update time.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Dynamic graph algorithms is a vibrant area of reasearch. An update operation on the graph is an insertion or a deletion of an edge or a vertex. The goal of a dynamic graph algorithm is to efficiently modify the solution after an update operation. A dynamic graph algorithm is said to be fully dynamic if the update operation includes both insertion or deletion of edges (or vertices). Dynamic algorithms for maintaining a maximal matching in a graph are well-studied and still present many research challenges. In particular, the approximate maximum cardinality matching (approximate MCM) problem is a very interesting question in the dynamic graph model. It is very well known from [5] that for each , a maximal matching that does not have augmenting paths of length upto is of size at least fraction of the maximum cardinality matching. This theorem provides a natural way of addressing this problem in the dynamic setting. However, there are two conditional lower bounds on the complexity of maintaining a maximal matching by eliminating augmenting paths of length upto 5. Assuming 3-sum hardness, Kopelowitz et al.[6] show that any algorithm that maintains a matching in which all the augmenting paths of length at most are removed requires an update time of for any fixed

. Secondly, assuming the Online Matrix Vector conjecture, Henzinger et al.

[4] show that any algorithm which maintains a maximal matching in which all the augmenting paths of length at most are removed requires an update time of for . Consequently, our aim in this paper is to understand the complexity of maintaining a maximal matching after eliminating augmenting paths of length 3. In Table [1] we tabulate current results and our result. The results in fourth row due to Neiman and Solomon [7] output a maximal matching without 3 length augmenting paths in time. Bernstein et al. [2] gave the first algorithm which achieve better than approximation in update time. They maintain a approximate matching in amortized update time. However their work does not provide the guarantee to maintain a maximal matching without any 3 length augmenting paths. We ask whether it is possible to remove all the augmenting paths of length up to in update time? We answer this question affirmatively. To the best of our knowledge, our algorithm is the first one to maintain an approximate matching in which all augmenting paths are of length at least in amortized update time. Our two main results are regarding the expected total update time, which is in Theorem 4.3, and regarding the worst case total update time with high probability which is Theorem 4.4.

Reference Approximation Update time Bound
Baswana et al. [1] 2 and expected and w.h.p
Solomon [9] 2 expected and w.h.p
Peleg and Solomon (uniformly sparse graph) [8] deterministic
Gupta and Peng [3] deterministic
Neiman and Solomon [7] deterministic
Bernstein and Stein [2] deterministic
This Paper[Theorem 4.3] 3/2 O() expected
This Paper[Theorem 4.4] 3/2 O() w.h.p
Table 1: A comparison of some of the previous results and our result for the dynamic approximate MCM problem

Paper Outline: In Section 2 we present an overview of how our algorithm is different from and how it extends the algorithm of Baswana et. al [1]. In Section 3 we describe the invariants maintained by our algorithms, the procedures in our algorithm, and analysis of the worst case running time of each procedure. In Section 4, we present the analysis of the expected total update time and the worst case total update time.

2 Outline of our Algorithm

To achieve our main result we extend the algorithm to maintain a maximal matching in the first part of the work by Baswana et al. [1] (hereafter referred to as BGS). We start by a brief and quick presentation of the ideas in BGS. BGS introduced the notion of edge ownership by a vertex. The number of edges owned by a vertex is at most its degree, and a vertex always searches for a mate among the edges that it owns. For every vertex this information is maintained as a ownership list . For an edge , if the edge is not owned by then it is owned by . Further, they maintain the invariant that if an edge is not owned by , then it means that is matched. Therefore for to look for a mate, it is sufficient for it to search for a mate among the edges it owns. BGS has two very important operations done by a vertex : scan its ownership list, and transfer an edge in its ownership list to the other vertex in the edge. The transfer of ownership is designed to ensure that if a vertex has to remain unmatched due to an update, then its ownership list is small (this does help a fast search for a mate subsequently). Clearly, these operations become expensive when the ownership list becomes large. BGS addressed this in the presence of an oblivious adversary, that is an adversary who does not generate the dynamic update requests based on the run-time behaviour of the algorithm. They addressed this by selecting a random mate from the ownership list whenever the ownership list of a matched vertex becomes large

. Specifically, they maintain a maximal matching in which a vertex whose ownership list is large is matched. The algorithm is implemented by organizing the vertices into two levels, namely level 0 and level 1. A vertex in level 0 has a small ownership list, and a vertex with a large ownership list is in level 1 and is matched. To analyze the expected amortized cost of maintaining a maximal matching, BGS first observes that the only updates which incur a cost greater than a constant are those that delete an edge in the matching or those that insert an edge between unmatched vertices. Further they classify the cost into two parts: that incurred by updates which involve vertices of low ownership (at level 0), and the cost incurred at vertices (at level 1) of high ownership. The cost incurred at a vertex in level 0 is small, since the ownership list is small. To analyze the expected amortized cost at level 1 vertices, BGS observe that the probability that an update by an oblivious adversary presents a randomly selected edge by the algorithm is at most the reciprocal of the size of the ownership list (which is large at level 1 vertices). This ensures that the expected amortized cost of maintaining a maximal matching over

updates is . By considering a ownership of size to be large, it follows that BGS maintain a maximal matching with expected amortized cost .

Removing 3 length augmenting paths-Our contribution

Conceptually, we extend BGS by deterministically checking at the end of each update whether a vertex affected by the update is part of 3 length augmenting path. For this our algorithm has to scan the whole neighbourhood of a matched vertex for an unmatched neighbour. Pessimistically, it seems that an oblivious adversary could force any algorithm to spend a high cost eliminating 3 length augmenting paths after finding mate with lower expected amortized cost. We observe by a careful analysis of our algorithm that this is not the case for eliminating 3 length augmenting paths. Central to our approach is the concept of an epoch in BGS. An epoch is a maximal runtime interval during which an edge is in the matching. As in BGS we associate with the beginning and ending of an epoch, the running time of the procedures that insert an edge into the matching and remove an edge from the matching. Apart from the procedures in BGS, we have the additional procedure to remove 3 length augmenting paths. Therefore, a single edge update by the oblivious adversary can trigger a sequence of changes to the matching, and apriori it is not clear how to analyze the length of this sequence. Our first contribution is that we ensure that this sequence is of constant length, that is any update only triggers a constant number of procedure calls, some to ensure that the matching is maximal, some to ensure that 3 length augmenting paths are eliminated, and some to ensure that unmatched vertices have a small ownership list and a small neighborhood list. The second crucial idea is that if an oblivious adversary has to force a high cost during the search of 3 length augmenting path involving one matching edge then the adversary would succeed at this task with probability which is the reciprocal of the large degree or should expect to make many low cost updates prior to the high cost update. We ensure this by matching a vertex of high degree to a randomly chosen neighbour in its ownership list. This is achieved by having a randomized courterpart for each deterministic method that changes the matching. This idea is already present in BGS where Random-Settle is the randomized counterpart of Naive-Settle. To complete the analysis, we observe that the expensive procedure calls made during runtime can be classified into one of the following two types:

  • Those expensive procedure calls that are preceeded by many low cost udpates.

  • The remaining expensive calls can be grouped into sets of constant size such that each set has a procedure call that matches a vertex to a randomly chosen neighbour in its ownership list.

Finally, like BGS we classify vertices into level 0 and level 1, but with rules that include the vertex degree also, apart from the size of the ownership list. Unlike BGS who use a Free array to keep track of whether a vertex is matched, we maintain a free neighbour list for each vertex. At first sight this operation is indeed an expensive operation, that an unmatched vertex must be maintained in the free neighbour list of all its neighbours. However, the expected amortized cost is still controlled to be by our algorithm.

3 Fully Dynamic Algorithm

Let be an undirected graph. Vertex set does not change throughout the algorithm and . The edge set changes during the course of the algorithm due to the insert and delete operations. We start with an empty graph. At every update step we allow an insertion or the deletion of exactly one edge. Given a matching , an edge is said to be matched if , otherwise edge is said to be unmatched. A vertex is said to be matched if there exist an edge such that , otherwise is called free. If then is called Mate of and is called Mate of . Let be an augmenting path of length 3 where and are free vertices and the edge is matched. We call is a 3 length augmenting path involving as the matched edge. Over a sequence of updates, we maintain a maximal matching of and ensure that the graph does not have an augmenting paths of length 3 with respect to . Therefore our matching is a approximate MCM. Similar to [1], in our algorithm we partition the vertex set into two levels 0 and 1. denotes the level of a vertex . For an edge , = max. We also define ownership for the edges similar to [1]. If both the endpoints of an edge have level 0 then both the endpoints own that edge. If level of one endpoint is and the other endpoint is , then the endpoint with level owns that edge. If both the endpoints have level 1 then ownership is assigned to anyone of the endpoints arbitrarily. For every vertex we maintain two sets : and . denotes the set of edges that owns. denotes the set of edges which are not owned by and whose other endpoint has level 1.

3.1 Invariants

Before an update step and after completion of an update step, our algorithm maintains the following invariants :

  1. All the vertices with level 1 are always matched. A free vertex with level 0 has all its neighbours matched.

  2. For a vertex with level 0, .

  3. For a matched vertex with level 0, for some constant . Here is defined as . Note that is the degree of .

  4. Both the endpoints of a matched edge have the same level.

  5. There is no 3 length augmenting path with respect to .

So invariant 1 and 5 together implies that is a approximate MCM.

Observation 3.1.

From Invariant 1, if is a free vertex with level 0 then all neighbours of are matched. Suppose at some update step, is matched to . Since prior to this update step was free, hence all its neighbours were matched. Therefore this update step will not result in a 3 length augmenting path which involves as the matched edge.

3.2 Data Structures

In this section we describe the data structures used by our algorithm. Our data structures are similar to the data structures used in [1] and [7].

  • Matching is maintained in a matrix of size . If edge is in the matching then entries and in the matrix are set to 1. Therefore insertion into the matching and deletion from the matching takes time.

  • For every vertex the set and is stored as a dynamic hash table. Hence search, delete and insert can be performed in time. Also the count = , which is the degree of , is maintained for every vertex .

  • For every vertex a data structure is maintained that stores the free neighbours of . This data structure supports insert and delete in time. In addition it supports the method has-free which returns TRUE if has a free neighbour in time, and the method get-free which returns an arbitrary free neighbour of in time. The data structure is implemented as follows : for every vertex , a boolean array of size is maintained which indicates the free neighbours of , a counter array of size in which the -th element stores the number of free neighbours in the range , and a variable for total number of free neighbours. So insert,delete and has-free are clearly operations. get-free requires a scan in the counter array to find a nonzero entry and then a scan in the boolean array in the appropriate range to find the free neighbour resulting in a operation.

3.3 Description of the Procedures

To handle updates and maintain the invariants over a sequence of updates our algorithm uses several procedures. We give a summarized description of these procedures in Table 2. The detailed description of the procedures along with the proofs of correctness and run-time analysis is also presented in this section. Since these procedures call each other in Table 3 we summarize the calling procedures and the conditions at the time of call. In this table we also point out the invariants that are ensured at the end of each procedure call. The pseudocode for each of the procedures is presented in Section 5. The names of the functions are also chosen in a very suggestive way, and also as an extension of the names in [1]: A settle function finds the mate of a vertex, a Raise function changes the level of a vertex from level 0 to level 1, a Fix function removes 3 length augmenting paths, and the Handle function deals with the delete of an edge in the matching at level 1.

Observation 3.2.

If a free vertex becomes matched, then for every neighbour of , must be removed from F(w). For one neighbour of , updating information about takes time. Therefore total time to update the status of for all neighbours of takes time . Similarly if a matched vertex becomes free, then for every neighbour of , must be added to F(z). For one neighbour of , updating information about takes time. Therefore total time to update status of for all neighbours of takes time .

NOTE : Vertex is matched randomly to means that the edge is selected uniformly at random from and included in the matching.

In the following two tables, we present the procedure calls made and the invariants the time of the call. The purpose of the tables is to give the reader an intuition of how the functions calls ensure that the five invariants are maintained by the algorithm on each update.

Procedure Description Computation time
Naive-Settle-Augmented(u,flag) Case If is in and . If is then Deterministic-Raise-Level-To-1 is called. Else Randomised-Raise-Level-To-1 is called.
Case If is in , and . If is then Deterministic-Raise-Level-To-1 is called. Else Randomised-Raise-Level-To-1 is called.
Case If is in , and . Edge is included in matching
Case If the list is empty, then procedure Fix-3-Aug-Path is called to check for 3 length augmenting path.
Random-Settle-Augmented(u) Case Selects an edge, say , uniformly at random from . If was matched then it returns the previous mate of . If has no free neighbour then procedure stops.
Case Selects an edge, say , uniformly at random from . If was matched then it returns the previous mate of . If is in then procedure Fix-3-Aug-Path-D is called.
Deterministic-Raise-Level-To-1 Vertex is matched, and level of is . Let is mate of . Levels and are changed to . Edges in are transferred to .
Randomised-Raise-Level-To-1 Vertex is matched, and level of is . Let is mate of . Edge is removed from the matching. Edges in are transferred to . Procedure Random-Settle-Augmented is called. If it returns a vertex and level of is then Handle-Delete-Level1(x,1) is called. Otherwise Naive-Settle-Augmented(x,1) is called.
Fix-3-Aug-Path-D is free, level of is , is matched and level of is . Let be the mate of . If () is in , then edge is removed from matching and edges and are included in the matching.
Fix-3-Aug-Path Initial Condition: is free, level of is , is matched and level of is or . Let be the mate of and () is in . Common step : is removed from matching and and are included in the matching. If level of is ,then levels of and are changed to
Case If , then procedure Random-Raise-Level-To-1 is called.
Case If and then procedure Random-Raise-Level-To-1 is called.
Case If and then,no further processing required.
Handle-Delete-Level1 Common step : is free, level of is . For every edge in , if level of is then is removed from and inserted to . Then :
Case If , then procedure Random-Settle-Augmented is called.
Case If , then Level of vertex is changed to . Procedure Naive-Settle-Augmented is called.
Table 2: Procedure Description table. Note that the value of distinguishes between a call to a randomised method () and the corresponding deterministic method ()
Called Procedure Calling Procedure Conditions at the time of call Invariant fixed by Called Procedure
Naive-Settle-Augmented(x,flag) Randomised-Raise-Level-To-1: is randomly matched to and = Mate x is free , Level of x is and flag is x will not violate Invariant 1
[Lemma 3.3.1]
Handle-Delete-Level1 is free, Level of is and flag is or will not violate Invariant 1
[Lemma 3.3.1]
Handle-Delete-Level1 : is randomly matched to and = Mate is free, Level of is and flag is or will not violate Invariant 1
[Lemma 3.3.1]
Random-Settle-Augmented(x) Handle-Insert-Level0 is free, Level of is 0 and will not violate Invariant 2
[Lemma 4]
Handle-Delete-Level1 : is or is free, Level of is 1 and will not violate Invariant 1
[Lemma 3.3.7]
Randomised-Raise-Level-To-1 is free, Level of is 0 and will not violate Invariant 3
[Lemma 3.3.4]
Deterministic-Raise-Level-To-1(x) Naive-Settle-Augmented is matched, Level of is 0 and will not violate Invariant 3
[Lemma 3.3.3]
Randomised-Raise-Level-To-1(x) Naive-Settle-Augmented is matched, Level of is 0 and will not violate Invariant 3
[Lemma 3.3.4]
Fix-3-Aug-Path : is a 3 length augmenting path where = Mate and is in is matched, Level of is 0 and will not violate Invariant 3
[Lemma 3.3.4]
Fix-3-Aug-Path-D Random-Settle-Augmented : is in is free, Level of is 0, is matched and Level of is 1 will not violate invariant 5.
[Lemma 3.3.5]
Fix-3-Aug-Path(x,y) Naive-Settle-Augmented: is in , = Mate and is in , is or is free, Level of is 0 and does not have a free neighbour will not violate Invariant 5
[Lemma 3.3.6]
Handle-Insert-Level0 is free, Level of is 0 and is matched will not violate Invariant 5
[Lemma 3.3.6]
Handle-Delete-Level1(x,flag) Randomised-Raise-Level-To-1 : is randomly matched to and =Mate is free and Level of is 1 will not violate Invariant 1
[Lemma 3.3.7]
Table 3: Procedure call table. For every deterministic procedure call we have a corresponding randomised counterpart. Columns 2 and 3 describe the algorithm state before the procedure call. Column 4 lists the invariant fixed by the call. Note that the value of distinguishes between a call to a randomised method () and the corresponding deterministic method ()

3.3.1 Naive-Settle-Augmented

Procedure receives a free vertex with level 0 and a as input. As described in Algorithm 1, the procedure Naive-Settle-Augmented works as follows :
It checks for a free neighbour of by calling Has-free. The following two cases describes the remaining processing.

  1. Vertex has a free neighbour and let be the free neighbour returned by get-free.

    1. If then vertex violates Invariant 3. If is 1 then the edge is included in matching and procedure Deterministic-Raise-Level-To-1 is called. Otherwise Randomised-Raise-Level-To-1 is called. At the end of this procedure will be a matched vertex at level 1. At the time of call to this procedure, was a free vertex and it was not violating any invariant. Therefore if gets matched to a vertex other than after call to procedure Randomised-Raise-Level-To-1 then will remain as a free vertex and it will not violate any invariant. If and then vertex violates Invariant 3 and hence same processing is repeated for . At the end of processing for , if is a free vertex then procedure Naive-Settle-Augmented is called.

    2. If and then the edge is included in matching . Therefore and are now matched vertices. No further processing is required.

    Let be the Mate of . Vertices and are removed from free neighbour lists of all their neighbours.

  2. Vertex does not have a free neighbour. If is part of a 3 length augmenting path then it violates Invariant 5. To check this, for every neighbour of , procedure Fix-3-Aug-Path is called.

At the end of procedure Naive-Settle-Augmented, vertex will not violate Invariant 1.

Proof.

Following two cases prove that will not violate Invariant 1 after call to Naive-Settle-Augmented.

  1. Vertex has a free neighbour. Therefore at the start of procedure call Naive-Settle-Augmented, is violating Invariant 1. Let be the free neighbour returned by get-free.

    1. . If is then procedure Randomised-Raise-Level-To-1 is called. As explained in section 3.3.4, after call to procedure Randomised-Raise-Level-To-1, will be a matched vertex and hence will not violate Invariant 1. If is 1 then edge is included in the matching and procedure Deterministic-Raise-Level-To-1 is called. As explained in section 3.3.3, after call to procedure Deterministic-Raise-Level-To-1, will be a matched vertex and hence will not violate Invariant 1.

    2. and . If is 1 then edge is included in the matching and procedure Deterministic-Raise-Level-To-1 is called. As explained in section 3.3.3, after call to procedure Deterministic-Raise-Level-To-1, will be a matched edge at level and hence will not violate Invariant 1. If is then procedure Randomised-Raise-Level-To-1 is called. After this call if remains free then procedure Naive-Settle-Augmented is called which will ensure that will not violate Invariant 1.

    3. and . Edge is included in the matching. Hence will not violate Invariant 1.

  2. Vertex does not have a free neighbour. Therefore does not violate Invariant 1.

Running time of procedure Naive-Settle-Augmented is :

  1. if has a free neighbour and and .

  2. in all other cases.

Proof.

Procedure has-free takes time. Remaining processing takes place as follows :

  1. Vertex has a free neighbour. Procedure get-free takes time and return a free neighbour, say .

    1. and . Edge is included in matching in time. Vertex is removed from free neighbour list of all its neighbours in time . Similarly vertex is removed from free neighbour list of all its neighbours in time . No further processing required and hence total processing time is .

    2. . If is then edge is included in matching in time and procedure Deterministic-Raise-Level-To-1 is called. From Lemma 3.3.3, time required for this procedure call is which is . If is then procedure Randomised-Raise-Level-To-1 is called. From Lemma 3.3.4, time required for this procedure call is . Therefore total processing time for Naive-Settle-Augmented is .

    3. and . This case is similar to the previous one and takes time .

  2. Vertex does not have a free neighbour. Procedure Naive-Settle-Augmented looks for a 3 length augmenting path if any starting at .

    1. No augmenting path starting at . Total time for processing is which is .

    2. There is an augmenting path starting at . Then procedure Fix-3-Aug-Path is called. From Lemma 3.3.6, procedure Fix-3-Aug-Path takes time and hence total processing time for Naive-Settle-Augmented is .

3.3.2 Random-Settle-Augmented

As described in Algorithm 2, the procedure works as follows : The procedure selects an edge uniformly at random from . Let be the randomly selected edge. For all the edges in , the edge is removed from and put in . If was matched and let = Mate, then this procedure returns . Otherwise, if was free then it returns NULL. After this, the procedure changes the level of and level of to 1 and the edge is included in the matching. The procedure also checks for any new 3 length augmenting path involving the matched edge using procedure Fix-3-Aug-Path-D. Let Vertex be at level 0 and inside procedure Insert. After a call to procedure Random-Settle-Augmented, vertex will not violate Invariant 2.

Proof.

Procedure Random-Settle-Augmented select an edge from uniformly at random. Let be the edge selected. At the end of the procedure, will be a matched edge at level 1. Hence will not violate Invariant 2. ∎

Running time of procedure Random-Settle-Augmented is , where is mate of , is free neighbour of and is free neighbour of .

Proof.

Selecting an edge uniformly at random takes time and . For every edge owned by , the edge is removed from and placed in . This step takes time . If was matched then mate of is obtained in time. Let be the previous mate of . Edge is removed from matching in time. Edge is included in the matching in time. Level of vertex and is changed to 1 in constant time. Vertex and is removed from the free neighbour lists of their neighbours. This takes time which is . If vertex does not have any free neighbour then processing stops at this point and total time required by procedure Random-Settle-Augmented is . Otherwise procedure Fix-3-Aug-Path-D is called. From Lemma 3.3.5, this procedure takes time, where is free neighbour of and is free neighbour of . Since , total time taken by procedure Random-Settle-Augmented is . ∎

3.3.3 Deterministic-Raise-Level-To-1

This procedure receives vertex as input. Vertex is a matched vertex at level 0 and . Therefore Invariant 3 is violated by vertex . As described in Algorithm 3, the procedure works as follows :
Let be the mate of . For every edge in , is removed from and added to . Similarly for every edge in , is removed from and added to . After this for every edge in , removed from and added to . Also, is removed from and added to . After this step is . Procedure changes the levels of and to 1. At the end of call to procedure Deterministic-Raise-Level-To-1, Invariant 3 is not violated by vertex .

Proof.

Let be the mate of . The procedure changes levels of vertices and to 1. The edge remains in the matching. Therefore at end of the procedure and are matched vertices at level 1. Hence Invariant 3 is not violated by vertex . ∎

Running time of procedure Deterministic-Raise-Level-To-1 is , where is mate of .

Proof.

Let be the mate of . For every edge in , is removed from and added to . Similarly for every edge in , is removed from and added to . After this for every edge in , removed from and added to . Also, is removed from and added to . Total time required for all these processing is which is . Therefore running time of procedure Deterministic-Raise-Level-To-1 is . ∎

3.3.4 Randomised-Raise-Level-To-1

Procedure Randomised-Raise-Level-To-1 receives a vertex as input which is a matched vertex at level 0 and . Therefore violates Invariant 3. As described in Algorithm 4, procedure Randomised-Raise-Level-To-1 works as follows :
Let be the mate of . Edge is removed from matching. For every edge in , is removed from and put in . For every edge in , is removed from and and placed in and . After this step, is . Among the edges in this procedure picks an edge uniformly at random using procedure Random-Settle-Augmented. Let be the edge picked at random. Following two cases describe the remaining processing :

  1. Level of is 1. Therefore is matched and let be the mate of . Edge is removed from the matching and becomes a free vertex at level 1. Therefore violates Invariant 1. To fix this procedure Handle-Delete-Level1 is called. Edge is included in the matching.

  2. Level of is 0. We describe the following cases :

    1. is matched and let be the mate of . Since edge is removed from the matching, is a free vertex at level 0. Procedure Naive-Settle-Augmented is called. Edge is included in the matching.

    2. was free then edge is included in the matching.

At the end of call to procedure Randomised-Raise-Level-To-1, Invariant 3 is not violated by vertex .

Proof.

Procedure Randomised-Raise-Level-To-1 calls procedure Random-Settle-Augmented. Procedure Random-Settle-Augmented selects an edge uniformly at random from . Edge is included in the matching and level of is . Therefore vertex becomes a matched vertex at level 1. Successive steps in the procedure does not involve vertex . Therefore at the time of completion of the procedure, remains matched at level 1. Hence Invariant 3 is not violated by vertex . ∎

Running time of procedure Randomised-Raise-Level-To-1 is .

Proof.

Mate of , say , is obtained in time and edge is removed from matching in time. For every edge in , is removed from and put in . For every edge in , is removed from and and placed in and . This takes time which is . After this procedure Random-Settle-Augmented is called. From Lemma 3.3.2, this procedure takes time. Let be the edge included into matching by procedure Random-Settle-Augmented.

  1. was free. Therefore no further processing required and hence total time taken by procedure Randomised-Raise-Level-To-1 is .

  2. was matched. Let be the previous mate of .

    1. Level of is . Procedure Handle-Delete-Level1 is called. From Lemma 3.3.7, this procedure takes time and hence total time taken by procedure Randomised-Raise-Level-To-1 is .

    2. Level of is . Procedure Naive-Settle-Augmented is called. From Lemma 3.3.1, this procedure takes time and hence total time taken by procedure Randomised-Raise-Level-To-1 is .

3.3.5 Fix-3-Aug-Path-D

Let be a free vertex and level of is . Let be a neighbour of , level of is 1 and let be the mate of . If has a free neighbour () then there is a 3 length augmenting path . This violates Invariant 5. As described in Algorithm 5, the procedure works as follows :
For all the edges in in , it removes from and puts in . Same processing is repeated for . Vertices and are removed from the free neighbour lists of all their neighbours. Edge is removed from the matching and edges and are included in the matching. Levels of and are changed to 1. At the end of procedure call Fix-3-Aug-Path-D there will not be any 3 length augmenting path starting at .

Proof.

It is clear from the description that at the start of call to procedure Fix-3-Aug-Path-D, if is a 3 length augmenting path then at the end of call to the procedure and will be matched edges at level 1. Therefore there will not be any 3 length augmenting path starting at . Again from observation 3.3, vertices and will not participate in a 3 length augmenting path until next update. ∎

Running time of procedure Fix-3-Aug-Path-D is .

Proof.

Mate of is obtained in time. Let be the mate of . Procedure has-free(y) checks in time if has a free neighbour. If a free neighbour, say , exist then is obtained in time using procedure get-free. For every edge , is removed from and put in . Vertex is removed from free neighbour list of all its neighbours. Same processing is repeated for vertex . Time required for all these processing is . Edge is removed from the matching in time and edges and are added to the matching in time. Levels of and are changed to in time. Therefore total processing time for procedure Fix-3-Aug-Path-D is which is . ∎

3.3.6 Fix-3-Aug-Path

Let be a free vertex. Let be a neighbour of and let be the mate of . If has a free neighbour and , then there is a 3 length augmenting path . This violates Invariant 5. As described in Algorithm 6, procedure Fix-3-Aug-Path works as follows :

  1. Level of vertex is 1.
    Edge is removed from the matching. Edges and are included in the matching. (Note that we are not changing the levels of and to immediately, but it will be taken care of during the subsequent processing in the following cases)

    1. . Procedure Randomised-Raise-Level-To-1 is called. If edge is not in the matching after call to procedure Randomised-Raise-Level-To-1 then this results in a free vertex at level . Therefore Handle-Delete-Level1 is called. For every neighbour of , is removed from F(). For every edge in , is shifted from to . Level of is changed to .

    2. and . Procedure Randomised-Raise-Level-To-1 is called. If edge is not in the matching after call to Randomised-Raise-Level-To-1, then this results in a free vertex at level 1. Therefore Handle-Delete-Level1 is called. For every edge in , is shifted from to . Level of is changed to .

    3. and . Levels of and are changed to 1. For every edge in , is shifted from to . Same is done for . Then levels of and are changed to 1. For every neighbour of , is removed from free neighbour list F(w). Similarly for every neighbour of , is removed from F().

  2. Level of vertex is 0.
    Edge is removed from the matching. Edges and are included in the matching. Vertex is removed from the free neighbour list of all its neighbours. Similarly vertex is removed from the free neighbour list of all its neighbours.

    1. . In this case procedure Randomised-Raise-Level-To-1 is called. If does not get matched to then procedure Naive-Settle-Augmented is called.

    2. . In this case procedure Randomised-Raise-Level-To-1 is called. If does not get matched to then procedure Naive-Settle-Augmented is called.

    3. and . No further processing is required.

At the end of procedure call Fix-3-Aug-Path there will not be any 3 length augmenting path starting at .

Proof.

If a 3 length augmenting starting at exists then procedure Fix-3-Aug-Path first finds such a path. Let be such a path where is mate of and is a free neighbour of .

  1. Level of vertex is 1. In this case edge is removed from the matching and edges and are included in the matching.

    1. . Procedure Randomised-Raise-Level-To-1 is called. From Lemma 3.3.4, vertex will be a matched vertex at level 1 after call to Randomised-Raise-Level-To-1. Therefore there will not be any 3 length augmenting path starting at . Level of is changed to and edge will be a matched edge at level .

      Observation 3.3.

      Since was free prior to this, hence and Mate will not participate in a 3 length augmenting before the next update.

    2. and . Procedure Randomised-Raise-Level-To-1 is called. After call to Randomised-Raise-Level-To-1, level of vertex is changed to 1 and edge is a matched edge at level . Since is matched now, therefore there is no 3 length augmenting path starting at . Observation 3.3 holds for .

    3. and . Levels of and are changed to 1. Therefore there will not be any 3 length augmenting path starting at . Observation 3.3 holds for both vertex and .

  2. Level of vertex is . In this case edge is removed from the matching and edges and are included in the matching. Observation 3.3 holds for both vertices and .

    1. . Procedure Randomised-Raise-Level-To-1 is called. From Lemma 3.3.4, after call to Randomised-Raise-Level-To-1, vertex will be a matched vertex at level 1. Therefore there will not be any 3 length augmenting path starting at .

    2. . No further processing done on vertex . Since is already matched, hence there is no 3 length augmenting path starting at .

Running time for procedure Fix-3-Aug-Path is

  1. if and ,
    where is a length augmenting path, is mate of and is free neighbour of .

  2. in all other cases.

Proof.

Mate of can be obtained in time. Let be the mate of . Procedure has-free takes time and checks if has a free neighbour. If a free neighbour, say , exist then is obtained in time using procedure get-free.

  1. and .
    Edge is removed from the matching in time. Edges and are added to the matching in time.

    1. Level of is 1. For every edge in , is removed from and put in . Similarly for every edge in , is removed from and put in . This takes time = , because both and are level vertices. Levels of and are changed to in time . Vertex is removed from the free neighbour list of all its neighbours and vertex is also removed from the free neighbour list of all its neighbours. This takes time . Therefore total processing time taken by procedure Fix-3-Aug-Path is .

    2. Level of is . Vertex is removed from the free neighbour list of all its neighbours and vertex is also removed from the free neighbour list of all its neighbours. This takes time . Therefore total processing time taken by procedure Fix-3-Aug-Path is .

  2. Otherwise it involves call to procedure Randomised-Raise-Level-To-1 and Handle-Delete-Level1. It is clear from Algorithm 6, it involves at most one call to procedure Handle-Delete-Level1 and one call to procedure Randomised-Raise-Level-To-1. From Lemma 3.3.4, time taken by procedure Randomised-Raise-Level-To-1 is . From Lemma 3.3.1, time taken by procedure Handle-Delete-Level1 is . Therefore total time taken by procedure Fix-3-Aug-Path is .

3.3.7 Handle-Delete-Level1

Let be a free vertex and level of is 1. This violates Invariant 1 of our algorithm. As described in Algorithm 7, procedure Handle-Delete-Level1 works as follows :
For every edge in , if level of is 1 then edge is removed from and inserted in . Following two cases describes the remaining processing.

  1. . Procedure Random-Settle-Augmented is called. After call to Random-Settle-Augmented, will be a matched vertex at level 1.

  2. . In this case, level of is changed to . For every edge in , is also included in . After this, if flag is 1 then Naive-Settle-Augmented is called and if flag is 0 then Naive-Settle-Augmented.

    1. Vertex has a free neighbour, say . Procedure Naive-Settle-Augmented will match to . We have described procedure Naive-Settle-Augmented in Section 3.3.1.

    2. Vertex does not have a free neighbour. In this case will remain as a free vertex at level 0. For every neighbour of , is included in F(w).

    Depending on the level of vertex , further processing takes place as described in the following two cases :

    1. Vertex remains at level 0. For all its neighbour in , increases by 1. If then procedure Random-Settle-Augmented is called.

    2. Vertex remains at level 1 and no further processing is required.

After call to procedure Handle-Delete-Level1, Invariant 1 is not violated by vertex .

Proof.

At the time of call to procedure Handle-Delete-Level1, is a free vertex at level 1. As shown in Algorithm 7, for every edge in where level of is 1, edge is removed from and inserted in . If , procedure Random-Settle-Augmented is called. As explained in Section 3.3.2, after call to procedure Random-Settle-Augmented, vertex will be a matched vertex at level 1. Hence Invariant 1 is not violated by vertex . If then level of vertex is changed to 0. After this procedure Naive-Settle-Augmented is called. From Lemma 3.3.1, after call to Naive-Settle-Augmented, vertex will not violate Invariant 1. ∎

Running time of procedure Handle-Delete-Level1 is .

Proof.

For every edge in , if level of is then is removed from and and inserted in and . This step may take time.

  1. If , then procedure Random-Settle-Augmented is called. From Lemma 3.3.2, call to Random-Settle-Augmented may take time. Let be the vertex returned by Random-Settle-Augmented. If is not NULL then procedure Naive-Settle-Augmented is called. From Lemma 3.3.1, call to procedure Naive-Settle-Augmented may take time. Therefore total time required by process Handle-Delete-Level1 is .

  2. If , then for every edge in , is also included in . This step takes time. After this procedure Naive-Settle-Augmented is called. From Lemma 3.3.1, call to procedure Naive-Settle-Augmented may take time. Therefore total time required by process Handle-Delete-Level1 is .

Note that if remains in level 0 then procedure may call Random-Settle-Augmented for if . There will be at most many such calls. However, in our analysis we will consider the time required for those calls as independent from the current call to Handle-Delete-Level1. ∎

3.4 Insertion

We describe procedure calls made during the insertion of an edge . Assuming that all the invariants are maintained before the insertion, we show that our algorithm maintains all the invariants after the insertion. Following four cases exhaustively describes the different insertion cases.
Insert(u,v):

  1. Level of is 1 and level of is 1. Edge is included in (or ) and (or respectively). If insertion is between two level 1 vertices then it takes time.

    Proof.

    Insertion of edge