Blocking Trails for -factors of Multigraphs
Abstract
Blocking flows were introduced by Dinic [3] to speed up the computation of maximum network flows. They have been used in algorithms for problems such as maximum cardinality matching of bipartite graphs [19, Hopcroft and Karp] and general graphs [24, Micali and Vazirani], maximum weight matching of general graphs [17, Gabow and Tarjan], and many others. The blocking algorithm of [17] for matching is based on depth-first search. We extend the depth-first search approach to find -factors of general multigraphs. Here is an arbitrary integral-valued function on vertices, an -matching is a subgraph where every vertex has degree , an -factor has equality in every degree bound. A set of blocking trails for an -matching is a maximal collection of edge-disjoint augmenting trails such that is a valid -matching.
Blocking trails are needed in efficient algorithms for maximum cardinality -matching [20], maximum weight -factors/matchings by scaling [4, 12], and approximate maximum weight -factors and -edge covers [20]. Since these algorithms find many sets of blocking trails, the time to find blocking trails is a dominant factor in the running time. Our blocking trail algorithm runs in linear time . In independent work and using a different approach, Huang and Pettie [20] present a blocking trails algorithm using time . As examples of the time bounds for the above applications, an approximate maximum weight -factor is found in time using [20], and our algorithm eliminates the factor . Similarly a maximum weight -factor is found in time using [20], (, the maximum edge weight) and our algorithm eliminates the factor, making the time within a factor of the bound for bipartite multigraphs.
The technical difficulty for this work stems from the fact that previous algorithms for both matching and -matching use vertex contractions to form blossoms. The dfs approach necessitates using edge contractions. As an example difficulty, edge contractions require extending the definition of blossom to ”skew blossoms” – configurations that must be reorganized in order to become valid blossoms. (The algorithm of [20] uses vertex contractions.)
1 Introduction
Blocking flows (aka blocking paths) are a fundamental tool for speeding up augmenting-type algorithms. They were introduced by Dinic [3] to obtain the first strongly polynomial algorithm for maximum network flow. Hopcroft and Karp [19] (and independently Karzanov [21]) applied the idea to maximum cardinality bipartite matching. They also proving its applicability to general graph matching, and Micali and Vazirani [24] gave the first blocking paths algorithm for general graph cardinality matching. Gabow and Tarjan applied blocking flows in cost-scaling algorithms for minimum cost network flow (aka degree-constrained subgraphs or -matchings) [16] and minimum cost general graph matching [17]. Here we have only cited some first applications of the idea, see reference [25, Sec. 9.6,10.8b,16.7a,17.5a,24.4a] for a comprehensive bibliography for the many uses of blocking paths.
We present an algorithm for blocking trails for -factors of general multigraphs. Here “general” is to be contrasted with “bipartite”, an important but much simpler special case. For the definitions of -factors, blocking trails, etc., please see the above abstract or the last paragraph of this section.
We turn to discussing recent work that applies blocking trails to multigraph -factors. Huang and Pettie [20] give algorithms for a host of problems on general multigraphs: They achieve time for maximum cardinality -matching. Here , i.e., twice the size of an -factor. The same bound holds for a minimum cardinality -edge cover (i.e., is a lower bound for degrees in the desired subgraph). These algorithms use a scaling algorithm that finds an approximation to the weighted version of the problem. The scaling algorithm uses time to find a -approximate maximum weight -matching, or a -approximate minimum weight -edge cover.
The next applications are scaling algorithms for maximum weight -factors. To put the results in perspective first recall the classic time bounds for (unweighted) bipartite -factors [21, 8]:
(1.1) |
For maximum weight bipartite -factors, Gabow and Tarjan [16] presented a scaling algorithm whose time bound is just a scaling factor above (1.1), i.e., time for simple graphs and for multigraphs. Here is the maximum (integral) edge weight.
Now consider general graphs. Duan, He and Zhang [4] give a scaling algorithm for maximum weight -factors of simple general graphs. The time is only logarithmic factors above (1.1), i.e., . In fact when all weights are 1 this is the first algorithm to achieve the bound of (1.1), to within logarithmic factors, for unweighted -factors of simple general graphs. Returning to weighted -factors, Gabow [12] gives a scaling algorithm that achieves the multigraph bound of (1.1), to within logarithmic factors, specifically .
All of the above algorithms use a subroutine that finds a set of blocking trails. The time bounds cited above assume the blocking set is found by the subroutine presented by Huang and Pettie [20]. It finds a blocking set (more specifically, a set of blocking trails and cycles) in time . Our blocking trail algorithm runs in time . Using our algorithm the above time bounds all decrease by a factor . (The decrease occurs in [4] but is hidden by the use of .)
Our algorithm is based on the depth-first-search approach to blocking paths for matching, introduced in [17]; see also [11]. Dfs is a natural approach for finding blocking paths, since backing up prematurely may necessitate reexploring edges later on. However it introduces complications for managing blossoms – they are usually processed immediately on discovery, but they are necessarily postponed in a dfs regime [17, 11]. Extending the dfs approach to -factors of general multigraphs introduces new complications, which we now summarize.
Fundamentally, in previous settings blossoms are “shrunk” using vertex contraction. This holds even in previous -factor algorithms, e.g., see the definition of blossom in [14]. However dfs requires shrinking by edge contraction. A first consequence is new way of discovering blossoms, which we call “skew blossoms”. Skew blossoms have the same properties as ordinary blossoms. However they require a reorganization in order to achieve valid blossom structure (Lemma 2.1).
A second consequence of dfs is incomplete blossoms, i.e., blossoms that do not get completely processed because of the discovery of an augmenting trail. Incomplete blossoms occur in ordinary matching, but they present additional complexity in -factors. Specifically because of edge contraction, an alternating trail from a later search can reenter an incomplete blossom. (See Sec.2.) The analysis of Sec.5 shows these reentries present no problem.
Finally edge-contracted blossoms are not immediately handled by the standard min-max formula for maximum cardinality -matching (which we require to prove the blocking property). We show the essential structure of vertex-contracted blossoms is preserved by our algorithm (e.g., Lemma 5.2).
These complications also reveal the high-level difference between our approach and that of Huang and Pettie [20]. Their algorithm uses vertex contraction rather than edge contraction. Its fundamental idea is cycle cancellation, which does not occur in our algorithm.
The paper is organized as follows. Section 2 discusses blossoms, first reviewing the definition of -factor blossoms, and discussing the new types of blossoms in our algorithm. Appendix A gives the depth-first search algorithm for blocking ordinary matchings [17, 11], for possible help in the reading of Section 2. Section 3 presents the blocking algorithm. Section 4 proves the algorithm constructs a valid search structure, most importantly, the blossoms are valid. Section 5 proves the augmenting trails found by the algorithm form a blocking set. This completes the analysis of the algorithm, which is summarized in Theorem 5.5.
Terminology and conventions
We often omit set braces from singleton sets, denoting as . So denotes . We abbreviate expressions to . We use a common summing notation: If is a function on elements and is a set of elements then denotes .
The trees in this paper are out-trees. Writing for an arc of a tree implies the arc joins parent to child . We extend parent and child relations to tree arcs, e.g., arc is the parent of . A node is an ancestor of a node allows the possibility , unless is a proper ancestor of . Similarly for arcs. A pendant edge has no children.
Graphs in this paper are undirected multigraphs. An edge joining vertices and is denoted . Note this notation ignores distinctions between multiple copies of an edge. Such distinctions are irrelevant to our algorithm. Also note that a loop at is denoted . Finally note that we use the usual shorthand notation to denote edge if context makes it clear that is a graph edge, not a tree arc. (This point is reiterated at the start of Section 3.)
In graph for and , () denotes the set of edges of with exactly one (respectively two) endpoints in . We omit (writing or ) when . A loop at belongs to . For multigraphs all of these sets are multisets.
Figures in this paper use the following conventions. Matched edges are drawn heavy, unmatched edges light. Free vertices are drawn as rectangles. Trails are indicated by arrowheads on their edges. A figure illustrating the algorithm can be drawn in the given graph or in an auxiliary graph (which is essentially the search tree; Fig.5(d.1) and (d.2) shows the two views). The view in is intuitive and informative but ambiguous: A given vertex can occur many times in the search, and an edge of the search leading to can potentially be used at any of these occurrences (again see Fig.5(d)). The same edge drawn in goes to a new occurrence of , clearly less informative. Of course there is no such difficulty in ordinary matching.
For an undirected multigraph with function , an -factor is a subgraph where each vertex has degree exactly . In a partial factor each has degree . is free if strict inequality holds.
We often call the edges of a partial -factor a matching or -matching.111An -matching is not to be confused with a -matching [25]. This paper never discusses the latter. So we refer to an ordinary matching as a 1-matching (i.e., is identically 1 for all vertices). is the deficiency of vertex in the current matching , .
When discussing a matching , the M-type of an edge is or depending on whether is matched or unmatched, respectively. We usually denote an arbitrary M-type as , and denotes the M-type of edge .
Consider a graph with an -matching . An augmenting trail is an alternating trail that begins and ends at a free vertex, such that is a valid matching, i.e., the two ends of the trail still satisfy their degree bound . (The trail may be closed, i.e., begins and ends at the same vertex. Alternating means consecutive edges of have opposite M-types.) An augmenting set is a collection of edge-disjoint augmenting trails such that is a valid -matching (i.e., rematching all the trails keeps every free vertex of within its degree bound .) A blocking trail set is a maximal augmenting set. It is the analog of a blocking flow.
2 Blossoms in
Blossoms are the main issue, and the main stumbling block, in any algorithm for matching general graphs. So it is appropriate to start with the new features of blossoms in our algorithm. This section starts by reviewing the natural definition of -factor blossoms presented in [14]. Then it introduces our new blossom variant, skew blossoms, and overviews the new potential difficulty for our algorithm, incomplete blossoms. Finally it presents a blossom substitute structure that allows our algorithm to treat weighted blossoms as ordinary vertices. Appendix A gives the predecessor of our algorithm and may be useful for Fig.2 showing incomplete blossoms.
Definition of Blossom, in
Our algorithm constructs blossoms that satisfy the definition presented in [14]. We call these ordinary blossoms. We briefly restate their definition below. Section 3 gives a similar definition for ordinary blossoms, but as they occur in our auxiliary graph rather than .
Let be a multigraph with an -matching. A blossom is a subgraph of that has a distinguished vertex, called the base vertex , and a distinguished incident edge, called the base edge , whose end in is . (If is free then is an artificial unmatched edge.) The detailed definition is recursive. We begin with a graph , the original graph with zero or more recursively defined blossoms contracted. A vertex in is either a contracted blossom or a vertex of called an atom. The new blossom is defined as a closed trail . begins and ends at a vertex of called the starter. Removing the starter from gives the blossom trail. The blossom trail must be alternating. Alternating means two consecutive edges meeting at an atom have opposite M-types; there is no restriction on edges meeting at a contracted blossom. Any atom may occur arbitrarily many times in . However a contracted blossom occurs at most once (a starter blossom occurs as both ends of ). Further if is in the blossom trail its base edge must be one of its two incident -edges.
In the base case of the recursion the starter is an atom, which is taken to be . The first and last edges of must have the same -type, which is called the M-type of . is an edge incident to , whose M-type is opposite that of . (So a blossom whose base vertex is free has M-type .)
In the recursive case the starter is a blossom (that is being enlarged). There is no restriction on the M-type of the starter’s two incident edges. The base vertex of is the base vertex of the starter. The same holds for the blossom’s M-type and its base edge, which must be incident to the trail .
Our definition of blossoms differs from [14] in an important way. The algorithms of [14] contract the vertex sets of blossoms. This is not compatible with the depth-first search strategy of our algorithm. Instead our definition of blossoms contracts edge sets. (The first example is Fig.5(d).) This means that a vertex of occuring in a contracted blossom of may also have atomic occurrences in . (Fig.7 illustrates the common case of pendant edges, introduced in Lemma 4.4().) In fact a vertex may also occur in many different blossoms of .
Our edge-contracted blossoms have three properties allowing them to function like vertex-contracted blossoms and make our algorithm correct. First is the most fundamental property of blossoms: An augmenting trail in (graph with all blossoms contracted) gives an augmenting trail in , if we add appropriate trails through contracted blossoms. The appropriate trails are called in [14]. Here is a vertex in a blossom with base vertex , and the edges of this trail are in the blossom subgraph of . The trails are constructed in Lemma 4.4 of [14]. This construction works for edge-contracted blossoms if we make one simple change: In every closed trail of a blossom, replace each occurrence of an atomic vertex by a new vertex . Clearly the edge contractions used in our definition correspond to vertex contractions in the modified graph. So the trails exist for edge-contracted blossoms.
The second property is a relaxed version of vertex-contracted blossoms: At any point in our algorithm a given vertex of occurs in at most one blossom. This is property , stated after Proposition 4.8. insures a given blossom occurs at most once in . It is also crucial in establishing the blocking property (starting with the definition of labels in (5.3)).
The third property is that in the search structure, a blossom has one entering edge (its base) and every other edge is leaving. This property fails for edge-contracted blossoms. However it holds when our algorithm halts (Corollary 5.1). This allows us to use the min-max formula for maximum cardinality -matching in Section 5 to establish the blocking property of our algorithm.
We continue with several more comments on the definition of blossom. First note that the aforementioned trails explain the interpretation of “alternating” in the definition of blossom (the alternating trails through the contracted blossom exist regardless of the edges incident to it in ). Second, a loop qualifies as a closed trail. So a blossom may have base vertex , closed trail , whose first and last edges are identical. Finally, a blossom is called heavy (light) when its M-type is (), respectively.
Skew Blossoms
Skew blossoms extend the algorithmic definition of blossom. They have the same structure as ordinary blossoms after a reorganization. The analysis of skew blossoms is similar to the construction of trails in [14]. Skew blossom are illustrated in Fig.1 and defined as follows.
Consider a graph with various blossoms contracted, including a blossom that contains a vertex . Let be an alternating trail, with first vertex and last vertex (the contracted) blossom , first edge and last edge . is a skew blossom.
Note the first vertex is an atom in and does not belong to . Also it is possible that . We may also have a loop at .
Lemma 2.1
is a valid blossom, with base vertex and M-type .
Proof: We wish to construct a blossom decomposition for the given skew blossom . This decomposition will be a sequence of closed trails , , satisfying the definition of a valid blossom, and having the same set of edges as . The initial blossom trail will start with the given trail from the atom to , and follow a trail in to an occurrence of on an edge of M-type .
To achieve this goal we will construct a sequence of alternating trails , , where each is a prefix of . The last trail will be the above initial blossom trail . Along the way we also construct the desired sequence of blossom trails . The construction maintains the invariant that starting with , adding the trails in order gives a valid blossom. Furthermore the construction ends with the consisting of the same edges as .
To begin observe that the vertex occurs as an atom in a unique closed trail of . Let refer to some fixed occurrence of in (chosen arbitrarily if there are more than one). Let and be the base vertex and base edge of the blossom corresponding to .
Suppose . Let be the subtrail of that starts with the edge of , follows to and then traverses . exists since alternates at . Let be the trail . Clearly adding to gives a valid blossom, which contains all of .
Now suppose . We proceed exactly as before. If the M-type of is then is the entire trail and is empty. If the M-type of is then is the single edge and is .
Now inductively assume ends with the edge , where is a blossom in the closed trail of . Proceed similar to the base case: Let and be the base vertex and base edge of . Let be the subtrail of that starts with edge , follows to and then traverses . Let be the trail . Adding to gives a valid blossom, which contains all of . As a special case it is possible that is the starter blossom for . In that case and .
Eventually we have . In that case and is as specified above.
Incomplete Blossoms
A successful search finds an augmenting trail. This leads to the possibility of incomplete blossoms. A blossom is incomplete if the blossom step has some invocation leading to a free vertex, so not all of the vertices in get scanned. Fig.2 gives examples of incomplete blossoms.
In 1-matching incomplete blossoms present little problem. In detail, the augment step removes all edges in the augmenting path . In 1-matching this removes all vertices on . The remaining vertices in have all been completely scanned (by the dfs order). So has the same properites as an ordinary blossom. This is not the case for multigraphs, since as illustrated in (a), a vertex on the augmenting trail remains in the graph with unscanned edges.
Eliminating Weighted Blossoms
Blocking trails are required in two types of applications of our algorithm: algorithms for maximum cardinality -factors and scaling algorithms for maximum weight -factors. Cardinality algorithms are handled directly by the algorithm of Section 3. But weighted algorithms require a modification of the graph, which we now describe.
In scaling algorithms, a blocking trail is found and rematched after each dual adjustment. The graph for the blocking trail is formed from the input graph by contracting every weighted blossom (i.e., blossom with positive dual variable ). A blocking set trail can pass through such a blossom only once. In contrast an ordinary vertex that is not in a weighted blossom can appear in many different blocking set trails, and many different times in each trail. In order to have all vertices alike we replace each weighted blossom by a blossom substitute, illustrated in Fig.3.
In detail consider a contracted blossom with base vertex , and base edge . ( does not exist if is a free vertex.) Let () denote a typical matched (unmatched) edge incident to other than . The blossom substitute for discards the vertices of and replaces them by a new vertex denoted and a new edge . It defines . If is a light blossom, is unmatched, each edge is replaced by matched , and each edge is replaced by unmatched . (Note that aside from , edges incident to in the original graph are treated as or edges in the substitute.) If is heavy then is matched, each edge is replaced by matched , and each edge is replaced by unmatched .
It is easy to see that blocking trails in the original graph correspond to blocking trails in the graph with substitutes, . In detail consider an alternating trail in and a weighted blossom . either contains or it does not. If contains , it contains (if it exists) and exactly one of the , edges. If does not contain it does not contain or or edge. Let be an alternating trail in . We give the details for a light blossom, heavy blossoms are symmetric. If contains , it contains (if it exists), and it either contains , exactly one edge and no edge, or it contains exactly one edge edge and no edge. If does not contain it does not contain , or any or edge.
3 The blocking trail algorithm
This section presents the algorithm. It illustrates the algorithm’s execution and elaborates on details of the algorithm statement.
The overall algorithm is called find_trails. It uses a recursive depth-first search routine called . We begin by describing the data structures and giving an overview of . Each vertex has two lists: contains the edges incident to that can be used in a grow step from . may be matched or unmatched, and may be a loop. A nonloop starts out in two GL’s, and is removed from both lists when a grow step is executed from the first end. Similarly the second list contains the edges incident to that can trigger a blossom step. When find_blocking_set begins the lists are initialized as
Each search for an augmenting path begins with the GL’s and BL’s as they were at the end of the previous search. (We shall see that a BL entry is relevant only in the search that created it.)
We manage each using a routine pop that removes edges from a list. Specifically pop removes and returns an element of list , where can be chosen arbitrarily with one exception: The first invocation of pop must return the first element that was added to . Obviously this is a special case of a FIFO queue, but we use pop for clarity and greater generality.
The routine works in two phases. It starts by using its GL to do every possible grow step. Then it uses the BL to do every possible blossom step. In this second phase contains the edges where the dfs retreated from .
The algorithm constructs a search tree consisting of the edges added in grow steps. To distinguish from we use the terms node and arc for elements of and , respectively. We view as an out-tree, so every arc is directed, from parent to child. Consider an edge of . An occurrence of in is denoted as or , where the arc is directed from the first vertex to the second, e.g., means is the parent.
Since a vertex can occur multiple times in , we identify nodes of by an incident -arc. Specifically let be an arc in . The notation refers to the node of at the end of , and is the node at the end. So node has the parent of or a child of .
The low-level algorithm represents blossoms using a data structure for set merging. The universe is the set of -nodes. The sets are the vertex sets of the current blossoms. (So these blossoms are complete or incomplete.) In the pseudocode below, is maintained as the set of all nodes in the blossom currently containing node . It is a simple matter to transform this to a low-level linear-time set merging algorithm [15] (also see the simplfied incremental-tree set-merging algorithm of [13]).222A node not in any blossom has . This condition also holds for a loop when edge is a singleton blossom. This double usage will not cause any confusion. At any point in time denotes the graph with the current blossoms (i.e., the sets) contracted.
An invocation of either returns normally or gets terminated, i.e., it stops execution prematurely. The latter occurs when an augmenting trail is discovered. When this occurs every invocation of in the current call chain is terminated. All those terminated invocations correspond to edges on the augmenting trail. This trail is added to , the set of all augmenting trails that have been discovered.
find_trails does not rematch the trails of , leaving that to the calling routine. For instance in applications of our algorithm for weighted matching, the rematching must undo the blossom substitutes. Rematching is further discussed in detail after Theorem 5.5 of Section 5. The other advantage of postponing the rematching is that it simplifies wording in the analysis.
In contrast, the algorithm maintains the quantities , , as the deficiency of vertex when the trails of have been rematched. This allows proper identification of the free vertices.
procedure find_trails
initialize to an empty forest and to an empty set
for ()
initialize to the deficiency of in the current matching
initialize lists to and to
for ()
if ( and no invocation has returned)
/* is an artificial vertex, a matched artificial arc */
return
procedure d()
if ( and and or )
/* augment step */
add the -path from to to
decrement and
terminate every currently executing invocation of , including this one
while ()
remove from and
/* grow step */
add an arc , from node to a new node , to
loop
/* blossom base test */
if (no occurrence of is in a blossom)
if () else break
/* blossom enlarge test */
else if ( or some descendant is in a blossom)
if () else break
/* blossom step */
let be the path in from to
for (every arc of ) merge into
for (every arc of , as ordered in but skipping the first arc)
/* blossom-invocation loop */
add to
return
Let us comment on various statements in the algorithm. An invocation made in the main routine is called a search (for an augmenting trail). This invocation is terminated iff an augmenting trail is discovered. So returns if no augmenting trail is discovered. The discussion following Lemma 4.7 will show remains free for the rest of the algorithm.
We make some conventions to justify the terminology for . As usual we call a search tree even though it is a forest (each search starts at a different root). Also we allow to contain loops (added in grow steps). Similarly we allow the path in a blossom step to contain loops.
We continue discussing the blossom step. Fig.6 is a high level illustration of the structure of the three types of blossoms in . In the blossom base test, it is unclear why the pop routine returns the correct edge (i.e., it may have the wrong M-type). Lemma 4.1 will show correctness. In the blossom enlarge test note is in a blossom is easily checked. Also let us informally explain this test (the explanation is proved rigorously below). The possibility that is in a blossom covers ordinary blossoms (the possibility holds when either is already the base vertex of a blossom, or or its reverse occurs on the blossom path). The possibility that is not in a blossom but is holds for skew blossoms. Next note that in the blossom step we identify each arc of by its nodes in . The blossom step may have empty, specifically . We call such a blossom step a noop since nothing changes (there are no merges or invocations). An invocation in a grow step adds to , but in the blossom step does not cause a similar addition. So the call chain of can be a proper subset of the current search path. (More precisely, an invocation in the current call chain has the corresponding arc or in the current search path. Within blossoms, the call chain may omit search path edges.)
For more motivation let us explain the restriction on in the blossom-invocation loop. (The explanation gets rigorously proved in our analysis below.) Let be the first arc of , i.e., is not called in the blossom-invocation loop. ( in Fig.6(a) and (c).) Let denote the blossom being formed. Consider two cases.
Suppose the first node of is not in a blossom. This means is either the first blossom formed with base edge , or is a skew blossom (Fig.6(a) or (c)). There is no need to invoke because the edges of have all been scanned before the blossom step. (In Fig.6(a) the scanning occurs because of edges and . In Fig.6(c) the scanning occurs in blossom or some subblossom.)
Suppose the first end of is in a blossom (Fig.6(b)). (We remark that this implies the last end of is also in .) There is no need for since belongs to . So just like the skew blossom case, gives an invocation with and .
We turn to the issue of blossom completeness. A blossom becomes complete when returns. (Recall there are two possibilities if is a free vertex, say . In a search rooted at , i.e., , is the artificial arc . Alternatively may occur in a search where it is not the root. In that case can be a matched -edge. In both cases can be completed when returns.)
4 Valid search structure
The goal of this section is to show find_trails constructs a valid search structure, i.e., all blossoms are valid and all search paths are alternating [14]. We adopt this as an invariant maintained by the algorithm:
(I1) Every step of the algorithm maintains a valid search structure, i.e., every blossom is valid and every path of the search structure is alternating.
The goal is achieved in Lemma 4.13.
All the proofs and other arguments in this section make the implicit assumption that all previous steps satisfy (I1). We explicitly prove (I1) for every step that modifies the search structure. As part of this analysis we will verify that the algorithm is well-defined. Specifically, in the blossom step it is unclear why the path exists for arbitrary . The other statements of the algorithm present no problems in terms of their meaning.
We start with a fundamental concept of the algorithm. Consider a vertex . Let be the first invocation of for that returns. Define to be the edge . This definition requires that is not terminated. For example an invocation that gives an unsuccessful search makes . If every search for a vertex is successful then is an edge of reached in a search rooted at some free vertex . need not exist in this case.
may be either arc or . In fact we will show the former always holds (Lemma 4.3) but this is not required at the moment. We usually abbreviate to when context establishes the identity of the node .
We begin the analysis by showing correctness of the pop routine.
Lemma 4.1
When an invocation satisfies the blossom base test, .
Remark: By definition is the first edge added to .
So in pop returns , The lemma shows
has the required M-type .
So pop operates correctly in the blossom base test. Correctness of pop
is not
an issue in the blossom enlarge test since any edge can be removed
from .
Proof: First observe that no operation pop has been performed previously in the blossom enlarge test, since that would mean a blossom already contains an occurrence of .
If the blossom base test is satisfied then is nonempty so exists.
Suppose for contradiction that .
Let be the edge that satisfies the blossom test, i.e.,
.
So . has returned
(since ). was added to before
returned (by definition of . Also since the edges have
opposite M-types.) So satisfied the blossom test before
. This triggered the operation pop, contradiction.
A blossom has a simple structure in :
Proposition 4.2
The nodes in a blossom form a subtree of . is the subtree’s root and is the parent arc of .
Proof: We induct on the size of the blossom. Let be the path in forming blossom . Before the blossom step merges values, the nodes on path form a subtree of . The inductive hypothesis, applied to each blossom on , implies this is a subtree of . After the merge this subtree corresponds to the set of nodes of .
Let be the invocation that forms blossom . Suppose
the blossom base test is satisfied. is the path from to
. So is and is , as
claimed in the lemma. Suppose the blossom enlarge test is satisfied. By
induction is before the merge of
values. As in the blossom base test, remains
.
Now we continue to investigate . In a slight abuse of notation we write to denote for the invocation defining . We next show this invocation is for a -arc . More generally, every invocation for an occurrence of in the call chain to corresponds to a -arc. Fig.5(f) illlustrates this with arcs , , , as well as .
Lemma 4.3
Every invocation made before returns has an arc of .
Remark: The lemma even includes invocations made in searches before
is invoked.
Proof: Suppose is executed for an arc . We show some invocation returns before is invoked. Clearly this implies returns before is invoked. The lemma follows.
Let be the parent arc of . ( may be the artificial arc .) We analyze two cases depending on whether returns before or after has entered a blossom.
Case is not in a blossom when returns: Since this case implies has not been invoked when returns. So is the desired edge .
Case is in a blossom when returns: Let be the blossom. We claim . To prove the claim suppose the contrary. Proposition 4.2 implies is in some blossom path . The code for a blossom step implies returns before the blossom is formed. This contradicts the case definition. So the claim holds.
Let be the edge triggering the blossom step that
makes a base. was added to when
returned. So returns before becomes a base
vertex. This is before blossom is formed. So it is before
is in a blossom. Thus it is before is invoked.
So is the desired edge .
Consider the special case of the lemma for occurrences of in searches before is invoked. Every such occurrence of is on a trail of . In proof, suppose is the arc leading to the occurrence of . The corresponding invocation does not return before returns (definition of ). So it is terminated, i.e., is on the augmenting path. Furthermore is not in a blossom (that would also imply has returned). So as claimed.
The next result establishes the significance of . We extend our notational convention to abbreviate to when is clear. Let be defined when is invoked, i.e., contains the augmenting trails in the searches before is reached.
Lemma 4.4
Fix a vertex .
() Let be an arc in , . There are two possibilities for :
() enters before is invoked: Either or is an ancestor of in , as well as , the contraction of when enters .
() enters after returns: is a pendant edge of throughout the execution of find_trails. Furthermore has M-type .
() Consider an invocation where . If pops an edge from then is empty. So no edge of is added to after the pop (this includes both the current search and future searches).
Remarks: () applies even if does not exist. If exists, it satisfies () ( is an ancestor of itself). It may also satisfy () ( has M-type and it may be pendant).
Lemma 4.11() extends () to describe the ancestors of after is popped. In Fig.5(d.2) the leaf occurrence of illustrates ().
We later prove that
() holds without the requirement on .
Proof: () First observe that () covers all possibilities for : In proof the only case not covered is that is invoked after is invoked and before returns. Such an invocation returns before returns. This contradicts the definition of .
() Assume is invoked in the same search as . (If not is invoked in a previous search, and as shown above .) is invoked before is invoked (assumption) and does not return before returns (definition of ). So returns during the execution of . (Notice this accounts for being terminated before it returns.) We have shown descends from in . is not in a contracted blossom of : The contrary makes an arc in the blossom path of . That implies returns before is formed, contradiction. ( may be the base of a contracted blossom.)
() returns with empty. is added to in a grow step so this implies it has M-type . Furthermore it implies does not execute any grow steps, i.e., is a pendant edge of tree . Thus () holds.
() since the two edges have opposite M-types.
So returns after .
returns with empty.
removes every edge of
before it pops any edge from .
So becomes empty before
pops
an edge from .
As an example suppose becomes a free vertex in an unsuccessful search. In () observe that there may be a path of multiple occurrences of . () shows that after the unsuccessful search, every occurrence of is a leaf. So will not be on an augmenting trail after the unsuccessful search.
The lemma contains the seeds of the entire algorithm, which we now sketch. (The sketch along with other structural details is proved in Lemmas 4.9–4.12.) Consider a fixed vertex . Each time an edge of is popped it triggers a blossom step. The blossom step may be a noop (i.e., the current blossom containing does not get enlarged). Ignoring these noops there are three successive “stages” for vertex : Stage 1 accounts for the time up until is popped and its blossom is formed. After that -pops trigger blossoms for leaf occurrences of (corresponds to Lemma 4.4()). We call this Stage 2. After that -pops form skew blossoms (corresponds to Lemma 4.4()). This is Stage 3. The search may halt, because of an augmenting trail, at any point during this progression (e.g., before is defined, before it is popped, etc.). Also at any point in the progression arbitrarily many blossoms may be formed by pops from lists for various vertices , and such blossoms may contain . For example in Stage 1 blossoms may absorb occurrences of vertex before is popped.
Vertex can occur in a blossom in only one search for an augmenting trail, the search where returns (Lemma 4.4() and its proof). So the pendant edge and skew blossom stages can only occur in the search where returns. (Regarding noops, the blossom step for may be a noop, e.g., consecutive arcs in a blossom path with – pops . Pendant edges and skew blossoms do not give noops. Other noops at arbitrary points may occur.)
As previously mentioned we must show the blossom step is well-defined. It is convenient to record that as the following property:
At the moment an invocation pops an edge from , descends from in .
Notice the contraction need not be the same as when was added to .
It is helpful to give some illustrations for . Fig. 7 shows needn’t hold if we change to .
Next consider Fig.8. It might seem to violate (I1) because executes as follows: The invocation executes a blossom step for edge . The blossom step invokes . It executes a blossom step for edge . But is not a descendant of . This purported counterexample is incorrect because the picture in (a) is impossible, the true picture is (b).
In our analysis of a fixed vertex we assume for all previous blossoms. This implies an enhanced version of the assumption: Suppose we are considering a blossom formed when an invocation pops an edge . Let be in the call chain from . implies that when returns, descends from .
implies any blossom formed after is invoked but before the pop has its base vertex descending from .
To set the stage for the ensuing discussion we extend Section 2’s definition of blossom. That definition specifies the properties of a blossom in the given graph . We now include the corresponding properties as they occur in the search tree .
Definition of Blossom, in and
Starter: The starter can be a node of where does not occur in the -subtree of any blossom. becomes the blossom base . The new blossom is formed by adding a blossom path that begins at node and ends at another -occurrence of . (In the code for , ends at , and ordinary blossoms have .) Blossom ’s occurrence in is formed by identifying the two node occurrences of . The first and last edges of must have the same M-type . The parent arc of is the base edge , which must have opposite M-type . (A special case is where the blossom path is the loop . ’s occurrence in is also that loop.)
A blossom can be enlarged by using as the starter. Blossom is formed by adding a blossom path that begins at some node of , and ends at an occurrence of some -vertex in subtree . (In the code for the starter is the blossom . As above ends at , and ordinary blossoms have .) Blossom ’s occurrence in is formed by identifying with node in . (Note from the code of that starts with some node in , not necessarily .) The M-types of the extreme edges of are arbitrary. The base vertex and edge of are inductively defined as those of .
For skew blossoms the starter is a node not in any blossom subtree, which becomes the base vertex . ends in a contracted blossom containing an occurrence of . (In the code for this blossom is .) All other requirements for skew blossoms are the same as ordinary blossoms.
Blossom trail: In the code for a blossom step, is a path in , the contraction of when blossom is triggered. Assuming , the -path is guaranteed to have all required properties of the blossom trail. Specifically, is guaranteed to be alternating, since the arcs of are in . If is a contracted blossom on , is guaranteed to contain ’s base edge, which is the parent arc of . This also guarantees that occurs only once in the trail of the blossom. This property extends to a starter blossom : Its base edge is the parent of the contracted , so does not reoccur in the blossom trail. A -vertex may occur arbitrarily many times in .
We start with some simple properties of blossoms. Consider the moment in time when a blossom becomes complete, i.e., returns. Let be a vertex that occurs in .
Proposition 4.5
When becomes complete, an invocation has returned for two edges of opposite M-type. Moreover has been popped.
Proof: Wlog assume is the first blossom to contain an occurrence of vertex .
Case occurs as : Let be the first edge of to trigger a blossom (not necessarily ). The invocations and are as desired. Obviously was popped.
Case does not occur as : is not the first or last vertex of the blossom path , since is not the base vertex and does not occur in a blossom when is formed. So contains an arc . is followed by an arc in , since is not in a blossom on (again by the choice of as first blossom). The invocations and are as desired.
Consider the moment when executes the blossom enlarge test.
has been emptied. In particular has been invoked
and has returned, adding to . So
pops unless some previous invocation popped it.
The next two results give the properties of the two blossom tests.
Proposition 4.6
Suppose executes the blossom enlarge test.
() Suppose is not in a blossom. satisfies the blossom enlarge test the pop triggers a skew blossom step.
() is in a blossom some current blossom has or arc in the blossom path of .
Proof: () is clear. For () consider two cases:
a -arc: During the execution of , the current blossom containing , , has base vertex (Proposition 4.2). So the first alternative () holds.
a -arc: Since the test
is executed by the invocation , is in the blossom path of a
current blossom. So the second alternative holds.
Lemma 4.7
() with pendant is a noop, i.e., it returns without executing a grow or blossom step.
() After a search that invokes , only occurs as a leaf of . Such occurrences do not enter blossoms.
Proof: () goes directly to the blossom tests. Clearly is not in a blossom at this point. So the blossom enlarge test fails. Suppose the blossom base test is satisfied. Then contains an edge with
(4.1) |
(Lemma 4.4() gives the second equality). has returned. returns before returns ( by (4.1)). So is in during the execution of . Thus satisfies the blossom base test (using (4.1)). It performs a blossom step. The occurrence of in a blossom means does not execute the blossom base test. Contradiction.
() Lemma 4.4() shows any occurrence of in a search after
the search invoking is a leaf of .
A pendant edge can enter a blossom only as the last edge of the blossom path, i.e.,
when it is popped from . But
part () shows the corresponding
execution of is a noop, i.e., it does not trigger a blossom step.
For intuition note this extension of part (): The occurrences of in part () never enter augmenting trails. In proof no grow step is executed from the occurrence, by part () and the nonoccurrence of in a blossom. So the -path to is not extended and does not lead to a free vertex. (This property is not required in the logic of our algorithm analysis.) In particular this extension shows that if a free vertex has a corresponding invocation that returns (as in the code for ) will never enter an augmenting trail in the rest of the execution of find_trails.
We now begin to track the status of a fixed vertex during the execution of find_trails. The following result applies to searches at the start of find_trails, specifically, before is discovered.
Proposition 4.8
Consider a search where no invocation returns. Any -arc of the search is on an augmenting trail. Furthermore does not occur in any blossom of the search.
Remarks: The search may contain arcs directed from .
The proposition may or may not apply to a search after
is defined.
Proof: Consider a -arc . (Such an arc always exists; for a free vertex it is the artificial arc .) The corresponding invocation was terminated, i.e., is on an augmenting trail.
is not an arc in a blossom path, again since
did not return. is not the base edge of a blossom, since the
first blossom containing contains . So as
claimed, does not occur in a blossom.
At any moment in find_trails a given vertex occurs in at most one blossom.
Observe that can enter a blossom only in the search that invokes : Proposition 4.8 shows this for searches before the invocation and Lemma 4.7() shows it for after. To establish we must show it holds throughout the search invoking . We have broken this search up into three time periods, Stages 1–3 for . The next several lemmas prove in each of these stages. Specifically Lemma 4.9 proves at any moment in Stage 1. Lemma 4.11() does this for Stage 2, and Lemma 4.12 for Stage 3.
Now assume some invocation in find_trails returns, i.e., exists. We account for the time up to and including the formation of the blossom for the pop of . Recall this time period is called Stage 1 for . It is possible that the pop of is a noop, but it is still included Stage 1. Fig. 9(a) gives an example. It is also possible that does not get popped. In that case Stage 1 ends after the last blossom containing is formed. Again this may be a noop.
Lemma 4.9
occurs in at most one blossom at any moment in Stage 1.
Proof: Consider a point in Stage 1 where there is a unique blossom containing one or more occurrences of . Let be the next blossom formed in Stage 1. If occurs in , we will show . Clearly this implies the lemma holds throughout Stage 1. Note that Stage 1 ends when is formed by a pop of , unless is never popped because of an augmenting trail.
Observe that descends from . In proof Proposition 4.5 shows that when returns, has been popped and so Stage 1 has ended. Thus is formed before returns. This implies descends from .
is irrelevant unless it contains an occurrence of . If does not contain a new occurrence of then as desired. Suppose has a new occurrence of , say on edge .
is not a pendant edge . In proof, is in the blossom path of . pendant must be the last edge of this blossom path. So the blossom is triggered by the pop of . is popped in an invocation . This pop was preceded by the pop of . But that ended Stage 1.
We conclude is
an
ancestor of , by Lemma 4.4().
Let be the -path from to .
We can assume is the arc on .
is an ancestor of (since contains , an ancestor of ).
is not an edge of , since
every invocation for an arc on returns before is formed.
Thus , as desired.
Note that if exists but does not get popped, any search after is invoked can add leaf occurrences of but no blossom containing (Lemma 4.7()).
Next we analyze the pop of . In particular part () of the next lemma shows that the pop of satisfies . Part () will also be used to show the Stage 2 blossoms satisfy .
Lemma 4.10
Suppose pops .
() . So when is popped, and no edge of will be added to after that.
() Let be the base edge of the first blossom containing an occurrence of . At every moment until returns, every edge of descends from . So every edge popped from during the execution of descends from .
Remark: Fig.9(a) gives an example of (). For instance
is the list
when the first blossom is
formed. In general may contain arcs directed to or from
, e.g., after returns enters .
Proof: () The second assertion follows immediately from the first using Lemma 4.4(). We turn to the first assertion.
Suppose is popped in the blossom base test. (In particular this implies is a -arc.) The blossom step makes the base edge of a blossom, . The test implies , as desired.
Now suppose satisfies the blossom enlarge test. (Note that may be invoked strictly after moment enters a blossom. In that case the pop of is a noop.)
Claim: does not occur in a complete blossom.
Proof of Claim: Assume it does occur. Proposition 4.5 implies has been invoked for edges with opposite M-types. Choose an invocation that has . is popped before returns, contradicting completeness.
must be in a blossom . If not, Proposition 4.6() implies is the base vertex of a skew blossom. But then the Claim gives a contradiction.
If the blossom base test has been executed and as shown above () holds. So Proposition 4.6() shows is an arc in the blossom path . The node is not in a blossom on , again by the Claim. The algorithm statement shows is not the first arc of . So contains an arc preceding . is not a base edge so . The alternation at implies .
() We first show descends from , i.e., holds for the pop of . Consider two cases. If then Lemma 4.4() shows descends from . Suppose . So occurs on the path of a blossom being formed, say on consecutive arcs , and . (Here we use for .) The invocation occurs before is formed and pops , (So .) Lemma 4.4() shows is an ancestor of , and is an ancestor of . Thus is an ancestor of and holds.
We continue with (). Since descends from , is empty when is invoked. From that moment on until returns, every edge added to descends from .
The second assertion of () follows siimilarly:
Lemma 4.9 shows that at the moment
forms
the blossom for ,
is the base of the blossom containing .
Note from part () that if is popped, no search after this pop contains an occurrence of .
Before proceeding it is worthwhile to give an incorrect proof for the first part of (), i.e., that holds for the pop of .
Incorrect Proof: Lemma 4.9 shows that at the moment the blossom for is formed, is the base of the unique blossom containing occurrences of . This makes an ancestor of since a blossom is a subtree of (Proposition 4.2).
The argument fails since the use of Proposition 4.2 assumes the blossom has already been properly formed, i.e., held for the blossom popping .
We now analyze the time from when pops until it returns. This is Stage 2.
Lemma 4.11
Suppose pops . In parts () and () is an arbitrary edge popped from during the execution of (i.e., from the moment is invoked and until it returns).
() The pop of makes it an edge of . So remains the only blossom containing an occurrence of .
() The pop of satisfies .
() Suppose returns. Every pendant edge ever created in the execution of find_trails was popped from during the execution of . So at the moment returns, every occurrence of in is either in or is a proper ancestor of not in any blossom.
Remarks: The arc corresponding to can be (blossom base test) or (blossom enlarge test).
Stage 2 can have blossom steps for pendant edges as well as noops. For example in Fig.9(a), where we have noted as the list , and trigger noops and is pendant. In general noops are for ancestors of .
The edge need not be in the first blossom containing an occurrence of . For instance in Fig.9(a) pops but is first blossom occurrence of .
In (), Fig.10 shows
a leaf can be
popped in an invocation other than .
Proof: () Lemma 4.9 shows () holds for , the first pop of .
Inductively assume () has always held up to some point in the execution of . As previously observed (proof of Lemma 4.7()) a pendant edge can enter a blossom only when it is popped from . Let be the next edge to be popped from . may be popped by an invocation , . (The arc for may be or , Fig.10(a) shows the latter.) is not pendant (Lemma 4.7()). So is a -ancestor of (Lemma 4.4(); may be ). is on the call chain starting from . Hence was in after the pop of (and possibly before that). So the pop of preserves (). This completes the induction.
() Although blossom steps during the execution of may enlarge without adding new occurrences of , remains . So Lemma 4.10() shows every edge popped during the execution of descends from . This gives ().
() Lemma 4.10() shows every pendant edge is created before is popped. is added to when returns. So is in before is popped.
returns with empty. Thus every pendant
edge gets popped from during the execution of
.
With () this implies
returns with containing every leaf occurrence
of in . () also shows is the only blossom
in which occurs.
Continuing we will track the execution of find_trails for vertex after of Lemma 4.11 returns. The return initiates Stage 3. First consider Stage 3 for the example of Fig.9: (which popped ) returns with . is on the search path to , so eventually it pops , executes a noop blossom for , and returns with . In Fig.9(b) edge triggers the skew blossom for and triggers the skew blossom for .
For the general case we continue with previous notation: pops . is the base edge of the blossom formed by that pop.
Lemma 4.12
After returns, the blossom steps triggered by pops of are as follows:
(a) Until returns each blossom is a noop.
(b) If is directed to the blossom is also a noop.
(c) After returns each blossom is a skew blossom. holds for this blossom.
At all times occurs in a unique blossom.
Remark: A blossom of (c) may be incomplete, as in
Fig.5(f) if the parent of is changed to
.
Proof: We will prove the following invariant holds after returns and until the current search ends. Let be the current blossom . Recall is a subtree of rooted at .
(I2) Any occurrence of either belongs to or is a proper -ancestor of , not in any blossom. is a singleton whose edge is in .
Note that (I2) implies the last assertion of the lemma, property .
The invariant holds at the moment returns. In proof, Lemma 4.11() gives the condition on occurrences of . Also , since the return adds to the previously emptied , and .
From this moment until returns, noops may change the entry in to some other occurrence of in . But (I2) is maintained. Now consider the return of . If is an arc directed to , i.e., , then the blossom is a noop, changes to , and (I2) is preserved.
Now assume (I2) holds after has returned, and a blossom step creates the next blossom . Let . Let be the first proper ancestor of that is an occurrence of , if such exists.
cannot change before control returns to . Suppose is formed before that. There are two possibilities. If is not an ancestor of , then no occurrence of enters (we use (I1) here). So (I2) is preserved. The other possibility is that properly descends from . is either disjoint from or contains . Again no new occurrence of enters a blossom and (I2) is preserved.
Now assume control returns to . The blossom enlarge test is satisfied. The entry in is an edge in . So is a skew blossom with base vertex . After this blossom step may get enlarged in but no occurrence of is added (again by (I1)). When returns (the arc directed to ) is added to . So (I2) is preserved.
To show for the skew blossom, observe is a -ancestor of . So is an ancestor of in the
current contraction .
Lemma 4.12 completes the proof of . As mentioned Lemma 4.10() shows does not occur in future searches if Stage 3 has been entered.
Note we have also verified that always holds: Lemmas 4.10(), 4.11(), and 4.12(c) establish for Stages 1,2, and 3 respectively.
We can now establish the validity of the search structure and . It simply amounts to the validity of the algorithm’s blossoms.
Lemma 4.13
Any blossom formed in the algorithm is valid, i.e., it satisfies the above Definition of Blossom, in and .
Proof: As noted in the Definition of Blossom in and , the requisite properties of the blossom trail hold automatically. So we need only verify the properties of the Starter. The requirements are satisfied trivially but for completeness we step through them.
The blossom base test forms ordinary blossoms with singleton starters . The blossom path correctly begins with and ends at (recall ). is the base edge and the blossom test ensures the first and last edges of the blossom trail have the same M-type, specificially .
Now suppose is in a blossom . The blossom step is triggered by the blossom enlarge test. is the starter blossom . As specified in the code, starts at a node in , called vertex in the Definition. implies the blossom path descends from . It ends at . Consider two possibilities:
: This implies , since is the only blossom containing an occurrence of . So is empty and the blossom step is a noop.
: If is the loop and is already a blossom, we again have a noop. Otherwise, identifying with gives a valid blossom.
In the blossom enlarge test, a skew blossom corresponds to the
alternative that is a singleton but some descendant is in a
blossom.
5 Blocking set
This section proves find_trails returns a valid blocking set. This culminates in the main Theorem 5.5, which is followed by a brief discussion of the linear time bound.
5.1 Search structure
We first give several additional properties of the search structure that hold when find_trails halts. They are needed to establish the blocking property.
We start by fleshing out Proposition 4.5. Again consider a moment in time when a blossom becomes complete. Note that every occurring in is in stage 3. Let and be the base vertex and edge of , respectively. Let be any edge incident to in , say .
Corollary 5.1
At the moment becomes complete, either
() is a proper -ancestor of , and is in the search path of , or
() , or
() and leaves either or in .
Remark: Part () is illustrated by arc in Fig.9(b).
Proof: is an arc of (in one direction or the other) by Lemma 4.10(). Lemma 4.11() shows the -end of is either in or is a proper ancestor of not in any blossom.
Case is a node of : The nodes of form a subtree of (Proposition 4.2). So if is the arc then and () holds. If is arc then it leaves the subtree of and () holds.
Case is a proper -ancestor of : If is arc then the invocation precedes in the call chain. Thus is in the current search path . is not in a contracted blossom since is the only blossom containing . So () holds.
Suppose . Since is not in a blossom
is in . It
is either in the -path to or it is incident to that path. In
the first case is in as before. In the second case is
incident to , giving ().
Now assume occurs in blossoms that are both complete and incomplete. Let denote the maximal complete blossom containing an occurrence of . Let the sequence of incomplete blossoms containing be , , . and may be identical or different. However the base edges , are identical. This follows since when is terminated every invocation of in the call chain is terminated, i.e., no new blossoms are formed.
The above sequence has some simple special cases, for an arbitrary vertex : may exist with . If does not exist define . may or may not be 0.
Let be the set of maximal complete blossoms when find_trails halts.
Lemma 5.2
A -arc not in any trail of or any set , has M-type .
Proof: First observe that exists, since invocation returns (i.e., it is not terminated). Suppose for the sake of contradiction that has M-type .
Claim 1 is not the base edge of any blossom formed in find_trails.
Proof of Claim 1: Suppose on the contrary that is the base edge of a blossom .
Suppose is incomplete. By definition the search’s augmenting trail includes . But this contradicts the lemma’s hypothesis on .
Suppose is complete. Let be the maximal complete blossom containing . Either or is on a blossom path contained in or a subblossom of . Both alternatives contradict the lemma’s hypothesis on .
Claim 2 occurs in some blossom when executes the blossom base test.
Proof of Claim 2: since the two edges have opposite M-type. Lemma 4.4() shows is a proper ancestor of . Thus enters during the execution of . In fact it enters before executes the blossom test. (It enters during the execution of a grow step in .)
Suppose Claim 2 fails. Then satisfies the first condition of the blossom base test. is still in . (If not it was popped, placing in a blossom. This contradicts the test’s first condition.) The second condition of the base blossom test is satisfied (since ). So is popped and becomes the base edge of a new blossom. This contradicts Claim 1.
Using Claim 2, let be an arc (directed to ) with in a blossom when executes the blossom base test. and are both ancestors of , so one is an ancestor of the other. For the moment assume . Let be the first blossom containing vertex . (It is possible that is incomplete.) There are four possibilities for , but none can hold:
Case an ancestor of : The execution of makes the base of a skew blossom, contradicting Claim 1.
Case : Contradicts Claim 1 again.
Case is on the blossom path of : executes the blossom base test before is formed. This contradicts the definition of . The same contradiction occurs if . (Note is either or it is on the blossom path of . The latter must hold if .)
Case descends from : This implies descends from .
Again
executes the blossom base test before is formed,
contradiction.
Lemma 5.3
A vertex that is free at end of a search wherein it occurs in a complete blossom has
(5.1) |
Furthermore choosing to be maximal makes .
Remarks: will be free when find_trails halts.
The hypothesis of maximality is necessary:
In
Fig.5() assume and .
The blossom of the figure is complete but
does not have base vertex .
But the maximal complete blossom, formed as a skew blossom at ,
has base vertex .
Proof: Let be the first blossom formed with an occurrence of . occurs on an edge of the blossom path .
Case does not occur as an interior vertex of : Since is not in a prior blossom, is the base vertex of and the base edge, say arc , is unmatched. starts by executing the test for an augment step. The test fails (since has not been formed yet). This implies (5.1).
Case occurs as an interior vertex of : alternates at so is on an unmatched edge of . The invocation is made before becomes complete. (The invocation may be for arc or .) As before it starts by executing the test for an augment, which fails ( has not been completed). So again (5.1) holds.
If , eventually control returns to the
invocation . It executes a skew blossom step.
This guarantees the second condition of the lemma.
5.2 Min-max relation
For disjoint sets of vertices let be the set of all edges with one end in and the other in . The maximum size an -matching (i.e., a subgraph where every vertex has degree ) is the minimum value of the expression
(5.2) |
where and range over all pairs of disjoint vertex sets, and in the summation ranges over all connected components of . This min-max relation is proved in [25, Theorem 32.1] by reduction; [14, Sec. 5.3] gives an algorithmic proof. This section gives another self-contained algorithmic proof, in the process of establishing the blocking property of our algorithm.
We first give some intuition for the relation. The set names are mnemonics for the tight case of the bound: We will show that equality holds for our matching by taking as the set of inner atoms and as the set of outer atoms. The connected components are formed by the remaining vertices, specifically vertices in blossoms and vertices not reached in any search. In the special case of our min-max relation is Edmonds’ odd set cover formula for a maximum cardinality matching [6, 22, 23]. We view our relation as a “generalized odd set formula”. Just like Edmonds’ formula the nontrivial part of the bound is due to rounding odd sets down by . For 1-matching the components are the blossoms and one more, the unreached vertices.
Let us show the expression (5.2) always upper bounds the size of an -matching. Classify the edges of G as type I (one or both ends in ), (both ends in ), and (joins a C vertex to a C or O vertex). Fix an -matching . trivially contains at most -edges and OO edges. Consider a connected component of . The number of edges of in is . The terms for trivially sum to at most . The terms for sum to at most . So is at most . Since is integral we can take the floor, thus giving the last term of (5.2).
We will show our algorithm finds a blocking set even if we make augmenting paths through complete blossoms residual. To be precise consider the graph when find_trails halts. Let be the set of all augmenting trails at that point. As before is the set of maximal complete blossoms. Define the residual graph to be . Let be the matching on when find_trails halts. Notice contains the matched edges of augmenting trails when they occur in blossoms of . For let be the deficiency computed by find_trails, i.e., the deficiency of in the matching on after augmenting the trails of . The degree constraint function on is
Throughout this section we will write and as and . This causes no problem. For instance the definition of shows deficiencies are identical in and . (We will use values when we apply (5.1) of Lemma 5.3.) We will show find_trails finds a maximum cardinality matching of .
An edge of is a residual edge. Note that a blossom need not have a base edge in . This occurs when a trail of passes through (or it simply contains an edge incident of ).
We will use (5.2) to show is a maximum cardinality matching of . To define sets and consider a vertex where the invocation returned but does not occur in any complete blossom.
(5.3) |
As an example a free vertex with deficiency greater than 1 is in (Lemma 5.3), so its value is not used in (5.2). We often refer to I and O as vertex labels, and call the vertices of unlabelled. Mnemonically note that is labelled according to arc : is I (O) if makes an inner (outer) vertex. Intuition for the labelling scheme is given in Fig.12.
There are two types of unlabelled vertices: If exists then an unlabelled is in a complete blossom of . The second possibility for unlabelled is that does not exist, i.e., no invocation ever returned. Equivalently, every occurrence of in was in an augmenting trail . Call such a vertex an orphan, i.e., does not occur in or occurs in but has no parent, e.g., vertex in Fig.5(b). (Note that a free vertex such a parent.) may contain residual arcs directed from . There may also be edges incident to that are not in , i.e., no corresponding grow step was executed.
We proceed to analyze the number of matched residual edges for each of the three types I, OO, . An vertex is not free (a free vertex is O or unlabelled). So exactly type I edges are matched. Thus achieves equality in (5.2) for type I edges.
Next consider an OO edge. Say it occurs as the -arc . It satisfies Lemma 5.2. (In particular is not the base edge of a -blossom , since is unlabelled.) Thus has M-type . So every OO edge is matched and achieves equality in (5.2) for OO edges.
It remains to consider the edges. Let be a connected component of unlabelled vertices. There are two similar cases, depending on whether or not contains an orphan. We analyze them in turn.
Case 1. consists of -blossoms: is a subtree of (Proposition 4.2, with augmenting trails included). consists of one or more -blossoms joined by their base edges. The root of this subtree is the base vertex of the “root” blossom . So a blossom in has its base edge in iff .
Next we analyze the edges of incident to a blossom . Consider a residual edge , .
Claim Either ( being arc ) or is arc with
(5.4) | labelled and or unlabelled and for a blossom . |
Proof of Claim: We will apply Corollary 5.1 to blossom , adjusting for events that occur after becomes complete. Consider the corollary’s three alternatives ()–() for :
() is one of two oppositely directed arcs, say and . is maximal complete so the skew blossom for was not completed. was either never triggered or was triggered and is incomplete. The first case has both arcs on the augmenting trail, so neither arc is residual. In the second case is on the augmenting trail. is not, since it is not on the search path of any invocation made in the blossom step. is residual, and in particular is not an orphan. So if is unlabelled then is the base edge of a blossom . The Claim holds. If is labelled then Lemma 5.2 applies (with taken as ). It shows . Again the Claim holds.
() as in the Claim.
() is arc . The analysis of in () applies, i.e., the same two possibilities of the Claim hold. Note that may originate from any number of occurrences of on .
We now show the component achieves equality in (5.2). The only fact we will use about edges incident to is the Claim. We will reuse the Claim when we analyze components that contain an orphan.
Let be the set of matched residual edges with one or both ends in . Define to be the set of -edges of type , and similarly for and . We will show the number of matched edges of type for our component equals its corresponding term in the summation of (5.2). To do this we show the number of ends of matched edges is exactly
(5.5) |
where . (Recall is the residual degree constraint function.) Since the left-hand side is even, implies is odd. So the desired equality always holds.
Let be the base vertex of the root blossom , and let be its base edge, also denoted as arc . The above quantity is the sum of three quantities , defined by
Clearly at most one of these quantities is 1. Fig. 13 illustrates the possibilities for .
The number of ends of matched edges of type is exactly
(5.6) |
To analyze this let be a residual edge incident to , with . The Claim and (5.4) show either for the root blossom or occurs as arc with labelled and is either
matched with labelled O or unmatched with labelled I. |
This implies
(5.7) |
Recall (Lemma 5.3) contains at most one free vertex, which must be , with and . Thus
(5.8) |
Case 2. contains an orphan: We start by analyzing the adjacencies of an orphan.
Lemma 5.4
Consider a residual edge incident to an orphan . Either is unlabelled and an orphan or satisfies (5.4).
Proof: Let denote edge .
Case is labelled: We will show , so (5.4) holds. If edge occurs as a -arc it must be arc ( is an orphan). Lemma 5.2 applies (in particular is not the base edge of a -blossom). It proves as claimed. Suppose is not a -arc. The invocation exists and returns (because of ’s label). was not removed in ( is an orphan). So again .
Case is unlabelled:
If is an orphan the lemma’s condition holds.
The other possibility is that is in a complete blossom .
We can assume . We have and
is the arc ( an orphan). The Claim above shows
. So (5.4) holds for taken as .
Define an orphanage to be a connected component of the graph induced on the residual graph by the set of orphans. (Its edges are the residual edges joining two orphans.) Clearly contains an orphanage, say . Lemma 5.4 and (5.4) show can be joined to other unlabelled vertices only by -arcs directed from to the base vertex of a complete blossom. Thus consists of and 0 or more subtrees that consist entirely of complete blossoms and are joined to by the root blossom’s base edge . We will show satisfies the tightness relation (5.5) with . To do this we examine the contribution to the right-hand side made from the orphanage and from a typical subtree .
First consider . Case 1 applies and shows (5.5). Furthermore does not leave the current component . So each and .
Now consider . (5.6) holds by definition. Since (5.4) holds for , (5.7) holds with . does not contain any free vertex, since a free vertex occurs in an unsuccessful search. So (5.8) holds with . As before combining these equations gives (5.5) with .
Now combining the instances of (5.5) for and all subtrees gives (5.5) for with . We have now verified the tightness of (5.2) for our labelling and the residual graph matching of find_trails. So our main result follows:
Theorem 5.5
find_trails finds a blocking trail set . In fact find_trails halts with a maximum cardinality matching of the residual graph.
Linear-time bound
It is straightforward to see that find_trails operates in linear time . Here counts each edge according to its multiplicity. Note the blossom enlarge test is easy to implement using Proposition 4.6(), since testing for a skew blossom is trivial.
For an algorithm to use our blocking set the trails of must be rematched. The inclusion of in the residual graph allows any alternating trail through a complete blossom to be rematched. Thus the trails of [14] may be used (even for skew blossoms). So postprocessing the augmenting trails uses time.
A Blocking 1-matchings
Fig.14 is a verbatim statement of the blocking algorithm for 1-matching of [17, 11]. It is the jumping off point for our -factor algorithm.
procedure find_ap_set
initialize to an empty graph and to an empty set
for (each vertex )
/* maintains the base vertex of */
for (each free vertex )
if then
add to as the root of a new search tree
find_ap
return
procedure find_ap()
/* is an outer vertex */
for (each edge ) scan from
if ()
if ( is free) completes an augmenting path
add to and add path to
terminate every currently executing recursive call to find_ap
else grow step
add to , where
find_ap
else if ( is an outer, proper descendant of
in ) /* blossom step */
/* equivalent test: became outer strictly after */
let , be the inner vertices in
, ordered so precedes
for ()
for (every vertex with , where )
/* this adds to the new outer blossom */
for () find_ap
/* process in order of increasing depth */
return
References
- [1]
- [2] W.J. Cook, W.H. Cunningham, W.R. Pulleyblank, and A. Schrijver, Combinatorial Optimization, Wiley and Sons, NY, 1998.
- [3] E.A. Dinic, ”Algorithm for solution of a problem of maximum flow in a network with power estimation”, Soviet Mathematics Doklady, 11, 1970, pp. 1277–1280. (In Russian.)
- [4] R. Duan, H. He, and T. Zhang, ”A scaling algorithm for weighted f-factors in general graphs”, Proc. of the 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), Vol. 168 of LIPIcs, pp. 41:1–41:17, 2020.
- [5] R. Duan, S. Pettie, and H-H. Su, ”Scaling algorithms for weighted matching in general graphs”, ACM Trans. Algorithms 14, 1, 2018, Article 8, 35 pages.
- [6] J. Edmonds, ”Paths, trees, and flowers”, Canad. J. Math. 17, 1965, pp. 449–467.
- [7] J. Edmonds, “Maximum matching and a polyhedron with 0,1-vertices”, J. Res. Nat. Bur. Standards 69B, 1965, pp. 125–130.
- [8] S. Even and R.E. Tarjan, “Network flow and testing graph connectivity”, SIAM J. Comput., 4, 1975, pp. 507–518.
- [9] H.N. Gabow, ”An efficient implementation of Edmonds’ algorithm for maximum matching on graphs”, J. ACM, 23, 2, 1976, pp. 221–234.
- [10] H.N. Gabow, “A scaling algorithm for weighted matching on general graphs,” Proc. 26th Annual Symp. on Found. of Comp. Sci., 1985, pp. 90–100.
- [11] H.N. Gabow, ”The weighted matching approach to maximum cardinality matching,” Fundamenta Informaticae 154, 1-4, 2017, pp. 109–130.
- [12] H.N. Gabow, ”A weight-scaling algorithm for -factors of multigraphs”, arXiv:2010.01102, 2020.
- [13] H.N. Gabow, ”A data structure for nearest common ancestors with linking”, ACM Trans. on Algorithms, 13, 4, 2017, Article 45, 28 pages.
- [14] H.N. Gabow, ”Data structures for weighted matching and extensions to -matching and -factors,” ACM Trans. on Algorithms, 14, 3, 2018, Article 39, 80 pages.
- [15] H.N. Gabow and R.E. Tarjan, “A linear-time algorithm for a special case of disjoint set union”, J. Comp. and System Sci., 30, 2, 1985, pp. 209–221.
- [16] H.N. Gabow and R.E. Tarjan, “Faster scaling algorithms for network problems,” SIAM J. Comput., 18, 5, 1989, pp. 1013–1036.
- [17] H.N. Gabow and R.E. Tarjan, “Faster scaling algorithms for general graph matching problems”, J. ACM 38, 4, 1991, pp. 815–853.
- [18] Z. Galil, S. Micali and H.N. Gabow, “An algorithm for finding a maximal weighted matching in general graphs”, SIAM J. Comput., 15, 1, 1986, pp. 120–130.
- [19] J. Hopcroft and R. Karp, “An algorithm for maximum matchings in bipartite graphs”, SIAM J. Comput., 2, 4, 1973, pp. 225–231.
- [20] D. Huang and S. Pettie, “Approximate generalized matching: -matchings and -edge covers”, arXiv:1706.05761, 2017.
- [21] A.V. Karzanov, ”On finding maximum flows in network with special structure and some applications”, Matematicheskie Voprosy Upravleniya Proizvodstvom, Vol 5, 1973, pp. 81–94. (In Russian.)
- [22] E.L. Lawler, Combinatorial Optimization: Networks and Matroids, Holt, Rinehart and Winston, New York, 1976.
- [23] L. Lovász and M.D. Plummer, Matching Theory, North-Holland Mathematic Studies 121, North-Holland, New York, 1986.
- [24] S. Micali and V.V. Vazirani, “An algorithm for finding maximum matching in general graphs”, Proc. 21st Annual Symp. on Found. of Comp. Sci., 1980, pp. 17–27.
- [25] A. Schrijver, Combinatorial Optimization: Polyhedra and Efficiency, Springer, NY, 2003.