Skip to main content
Log in

A Weight-Scaling Algorithm for f-Factors of Multigraphs

  • Published:
Algorithmica Aims and scope Submit manuscript

Abstract

The challenge for graph matching algorithms is to extend known time bounds for bipartite graphs to general graphs. We discuss combinatorial algorithms for finding a maximum weight f-factor on an arbitrary multigraph, for given integral weights of magnitude at most W. (An f-factor is a subgraph whose degree function is the given function \(f:V\rightarrow {\mathbb {N}}\).) For simple bipartite graphs the best-known time bound for combinatorial algorithms is \(O(n^{2/3}\, m\, \log nW)\) [Gabow and Tarjan, SIAM J Comput 18(5):1013–1036, 1989; n and m are respectively the number of vertices and edges.] A recent algorithm of Duan et al. [in: Proc. of the 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), 2020] for f-factors of simple general graphs comes within logarithmic factors of this bound, \({\widetilde{O}} (n^{2/3}\, m\, \log W)\). The best-known bound for bipartite multigraphs is \(O(\sqrt{\Phi }\, m\, \log \Phi W)\) (\(\Phi \le m\) is the size of the f-factor, \(\Phi =\sum _{v\in V}f(v)/2\)). This bound is more general than the restriction to simple graphs, and is even superior on “small” simple graphs, i.e., \(\Phi =o(n^{4/3})\). We present an algorithm that comes within a \(\sqrt{\log \Phi }\) factor of this bound, i.e., \(O(\sqrt{\Phi \log \Phi }\,m \,\log \Phi W)\). The algorithm is a direct generalization of the algorithm of Gabow and Tarjan [J ACM 38(4):815–853, 1991] for the special case of ordinary matching (\(f\equiv 1\)). We present that algorithm first. Our analysis is a simplified and more concrete version of Gabow and Tarjan [J ACM 38(4):815–853, 1991] and has independent interest. Furthermore the algorithm and analysis are both incorporated, without modification, into the f-factor algorithm. To extend these ideas to f-factors, the first step is “expanding” edges (i.e., replacing an edge by a length 3 alternating path). Duan et al. [in: Proc. of the 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), 2020] uses a one-time expansion of the entire graph. In contrast, our algorithm keeps the graph small by only expanding selected edges (edges incident to blossoms, in “I(B) sets”). Expanded edges get “compressed” back to their source when no longer needed. Expansion necessitates using an alternate graph model for blossoms (we call them “e-blossoms”). Compression requires coordinating e-blossoms with standard blossoms.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21

Similar content being viewed by others

Notes

  1. Corollary 4.6 shows the first scale of our algorithm finds an f-factor of a given multigraph in time \(O(\sqrt{\Phi \log \Phi }\;m)\). Huang and Pettie [18] achieve time \(O(\sqrt{\Phi }\;m\; \alpha (m,n))\) for maximum cardinality f-matching, a more general result.

  2. Each variant of weighted matching, be it perfect matching, maximum cardinality matching, etc., has a variant of the primal LP.

  3. Note that the notion of an “uncrossed shell” is more permissive than what we are using: A shell with a matched edge from D to \(V-C\) is uncrossed. But the proof of Lemma 3.2 fails for such a shell. Unlike Gabow and Tarjan [15] we avoid the term “uncrossed shell” since it seems ambiguous and misleading. Our notions of “crossing” are standard and reviewed in the Terminology section.

  4. The square brackets help to distinguish the dual objective from a function evaluation \(\widehat{yz}(T)=\sum _{e\in T} \widehat{yz}(e)\). Observe S is a set of vertices and T is a set of edges.

  5. The term “undervalued” is the analog of “strictly underrated” when optimum duals are used. See Appendix C.

  6. This restriction is only for notational convenience. The properties of any shell \((S^+,\emptyset )\) are essentially the same.

  7. Throughout this appendix d denotes the degree function, not to be confused with the d counting dual adjustments in the analysis of the scaling algorithm. Note \(d(v)=|\delta (v)|+2|\gamma (v)|\).

References

  1. Brand, J.V.D., Lee, Y.T., Liu, Y.P., Saranurak, T., Sidford, A., Song, Z., Wang, D.: Minimum cost flows, MDPs, and \(\ell _1\)-regression in nearly linear time for dense instances. In: Proc. 53 Annual ACM Symp. on Theory of Comp., pp. 859–869 (2021)

  2. Cook, W.J., Cunningham, W.H., Pulleyblank, W.R., Schrijver, A.: Combinatorial Optimization. Wiley and Sons, New York (1998)

    MATH  Google Scholar 

  3. Duan, R., He, H., Zhang, T.: A scaling algorithm for weighted f-factors in general graphs. In: Proc. of the 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), vol. 168 of LIPIcs, pp. 41:1–41:17 (2020)

  4. Duan, R., Pettie, S., Su, H.-H.: Scaling algorithms for weighted matching in general graphs. ACM Trans. Algorithms 14(1), 1–35 (2018)

    Article  MathSciNet  MATH  Google Scholar 

  5. Edmonds, J.: Maximum matching and a polyhedron with 0,1-vertices. J. Res. Nat. Bur. Stand. 69B, 125–130 (1965)

    Article  MathSciNet  MATH  Google Scholar 

  6. Even, S., Tarjan, R.E.: Network flow and testing graph connectivity. SIAM J. Comput. 4, 507–518 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  7. Fredman, M.L., Tarjan, R.E.: Fibonacci heaps and their uses in improved network optimization algorithms. J. ACM 34(3), 596–615 (1987)

    Article  MathSciNet  MATH  Google Scholar 

  8. Gabow, H.N.: A scaling algorithm for weighted matching on general graphs. In: Proc. 26th Annual Symp. on Found. of Comp. Sci., pp. 90–100 (1985)

  9. Gabow, H.N.: Blocking trails for \(f\)-factors of multigraphs. arXiv:2112.04096

  10. Gabow, H.N.: Data structures for weighted matching and extensions to \(b\)-matching and \(f\)-factors. ACM Trans. Algorithms 14(3), 1–80 (2018)

    Article  MathSciNet  MATH  Google Scholar 

  11. Gabow, H.N.: An efficient implementation of Edmonds’ algorithm for maximum matching on graphs. J. ACM 23(2), 221–234 (1976)

    Article  MathSciNet  MATH  Google Scholar 

  12. Gabow, H.N.: The weighted matching approach to maximum cardinality matching. Fund. Inform. 154(1–4), 109–130 (2017)

    MathSciNet  MATH  Google Scholar 

  13. Gabow, H.N., Tarjan, R.E.: A linear-time algorithm for a special case of disjoint set union. J. Comput. Syst. Sci. 30(2), 209–221 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  14. Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for network problems. SIAM J. Comput. 18(5), 1013–1036 (1989)

    Article  MathSciNet  MATH  Google Scholar 

  15. Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for general graph matching problems. J. ACM 38(4), 815–853 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  16. Galil, Z., Micali, S., Gabow, H.N.: An \(O(EV \log V)\) algorithm for finding a maximal weighted matching in general graphs. SIAM J. Comput. 15(1), 120–130 (1986)

    Article  MathSciNet  MATH  Google Scholar 

  17. Hopcroft, J., Karp, R.: An \(n^{5 / 2}\) algorithm for maximum matchings in bipartite graphs. SIAM J. Comput. 2(4), 225–231 (1973)

    Article  MathSciNet  MATH  Google Scholar 

  18. Huang, D., Pettie, S.: Approximate generalized matching: \(f\)-matchings and \(f\)-edge covers. Algorithmica 84(7), 1952–1992 (2022)

    Article  MathSciNet  MATH  Google Scholar 

  19. Karzanov, A.V.: On finding maximum flows in network with special structure and some applications. Mat. Vopr. Upr. Proizvod. 5, 81–94 (1973). ((In Russian.))

    Google Scholar 

  20. Kuhn, H.W.: The Hungarian method for the assignment problem. Naval Res. Log. Q. 2, 83–97 (1955)

    Article  MathSciNet  MATH  Google Scholar 

  21. Lawler, E.L.: Combinatorial Optimization: Networks and Matroids. Holt, Rinehart and Winston, New York (1976)

    MATH  Google Scholar 

  22. Lovász, L., Plummer, M.D.: Matching Theory, North-Holland Mathematic Studies, vol. 121. North-Holland, New York (1986)

    Google Scholar 

  23. Micali, S., Vazirani, V.V.: An \(O(\sqrt{|V|} \cdot |E|)\) algorithm for finding maximum matching in general graphs. In: Proc. 21st Annual Symp. on Found. of Comp. Sci., 21st, pp. 17–27 (1980)

  24. Schrijver, A.: Combinatorial Optimization: Polyhedra and Efficiency. Springer, New York (2003)

    MATH  Google Scholar 

  25. Tarjan, R.E.: Applications of path compression on balanced trees. J. ACM 26(4), 690–715 (1979)

    Article  MathSciNet  MATH  Google Scholar 

  26. Thorup, M.: Undirected single-source shortest paths with positive integer weights in linear time. J. ACM 46(3), 362–394 (1999)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

The author thanks Seth Pettie for helpful conversations regarding Ref. [4]. Thanks also to an anonymous referee for very careful reading and many suggestions to clarify the narrative.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Harold N. Gabow.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

A Edmonds’ Algorithm for Matching

For background we first review the linear program for maximum weight perfect matching. The variables are given by the function \(x:E \rightarrow \mathbb {R_+}\) which indicates whether or not an edge is matched. Recall our summing convention, e.g., \(x(\delta (v))=\sum _{e\in \delta (v)}x(e)\).

maximize \(\sum _{e\in E} w(e)x(e)\) subject to

$$\begin{aligned} \begin{array}{llll} x(\delta (v))&{}=&{}1&{}\forall v\in V\\ x(\gamma (B))&{}\le &{} \lfloor {|B|\over 2} \rfloor &{}\forall B\subseteq V\\ x(e)&{}\ge &{} 0&{}\forall e\in E \end{array} \end{aligned}$$

The dual LP uses dual functions \(y:V \rightarrow {\mathbb {R}}\), \(z:2^V\rightarrow \mathbb {R_+}\). Define \(\widehat{yz}:E\rightarrow {\mathbb {R}}\) by

$$\begin{aligned} \widehat{yz}(e) = y(e) + z\{ B:e \subseteq B \}. \end{aligned}$$
(A.1)

(Note for \(e=uv\), y(e) denotes \(y(u)+y(v)\) and \(z\{ B:e \subseteq B \}\) denotes \(\sum _{e \subseteq B} z(B)\).)

$$\begin{aligned} \hbox {minimize }y(V) + {\sum }_{B\subseteq V} \lfloor {|B|\over 2} \rfloor \, z(B) \hbox { subject to}\\ \begin{array}{llll} \widehat{yz}(e) &{}\ge &{} w(e)&{}\forall e\in E\\ z(B)&{}\ge &{} 0&{}\forall B\subseteq V \end{array} \end{aligned}$$
Fig. 22
figure 22

Pseudocode for an Edmonds search, for perfect matching with near-optimum duals

A precise statement of Edmonds’ algorithm is given in Fig. 22. We briefly summarize the algorithm, although we assume the reader is familiar with a complete treatment.

The search structure \({\overline{\mathcal {S}}}\) is a forest. Its nodes are contracted blossoms or vertices that are not in blossoms. For simplicity in this section we call the latter “blossoms” as well.

The roots of \({\overline{\mathcal {S}}}\) are the free blossoms, i.e., the blossoms that contain an unmatched vertex. The forest is alternating, i.e., the edges from a node to its root alternate between being matched and unmatched. The last edge (incident to the root) is necessarily unmatched. If the first edge is unmatched the node is inner. Otherwise (i.e., the first edge is matched or the node is a root) the node is outer.

For B a blossom in \({\overline{\mathcal {S}}}\), an edge \(e \notin {\overline{\mathcal {S}}}\) alternates with B if e is unmatched for B outer and matched for B inner. (Note if e alternates with B then B can be replaced by an appropriate alternating path so there is an alternating path of edges of G from e to its forest root.)

For any vertex v of G, \(B_v\) denotes the maximal blossom containing v (or v itself if no bigger blossom exists). Let M denote the current matching. In a grow step, if \(B_x\) is outer then \(xy\notin M\) and \(B_y\) becomes inner; if \(B_x\) is inner then \(xy\in M\) and \(B_y\) becomes outer. A blossom step necessarily creates a new outer node. When an augmenting path is discovered, the algorithm proceeds to augment a maximal collection of disjoint augmenting paths of eligible edges.

In the dual adjustment step, define the “target” t(e) of edge e that is not in the search structure to be the value of yz(e) that makes e eligible, i.e., t(e) is the value of (2.3). (When we execute Edmonds’ algorithm in Phases 2 or 3 the definition of eligibility changes to (2.4) and the target becomes the value closest to the current value of yz(e). For instance an unmatched edge with \(yz(e)>w(e)\) has target \(t(e)=w(e)\).)

B Implementation of the Dismantler 

This section presents the data structures and implementation details for Phases 1 and 2 of DismantlePath \((Q)\). We show the total time is \(O(\sqrt{|Q|\log |Q|} m(Q))\) for matching on graphs. The discussion applies equally well to f-factors (since the \(f\)-Dismantler is identical to the Dismantler ) making obvious textual changes, e.g., the time is \(O(\sqrt{f(Q)\log f(Q)} m(Q))\).

Edmonds’ search is implemented with known data structures. (These include nontrivial data structures for set merging [13] and split-findmin [26].) We use a data structure for set merging to track the current partition of V into atomic shells. It suffices to use the simple “relabel-the-smaller-half” strategy: Over the course of an entire scale, the atomic shell containing a given vertex v changes by merging operations (even as DismantlePath transitions from one major path to the next). So v can be examined every time its shell is merged into a larger shell. Thus the total overhead for set-merging, over an entire scale, is \(O(n\log n)\).

Each current atomic shell S records various items. The size |S| is known from the set-merging data structure. S has a list of its free vertices. S has pointers to its boundary blossoms. Each inherited blossom B records the initial dual value \(z_0(B)\) and the current value \(\tau (B)\). All current atomic shells of P(Q) are maintained in a linked list that is ordered as in P(Q). The list has a pointer to the maximal undissolved blossom of P(Q).

The graph is represented using a simple adjacency structure. When scanning the adjacencies of a vertex in shell S it is easy to distinguish edges that remain in S from edges that leave S.

The current dual functions yz are maintained using the quantities

$$\begin{aligned} y'(v)=y(v)+z\{ B:v\in B\in \Omega ^- \}/2. \end{aligned}$$

These quantities are initialized at the start of the scale using \(y_0\) and \(z_0\). They are maintained in Edmonds searches, i.e., a dual adjustment changing y by \(\pm 1\) makes the same change to \(y'\). \(y'(v)\) does not change in any unit translation of an inherited blossom (unlike \(y'\) of Gabow and Tarjan [15]).

We compute \(\widehat{yz}\) values (as needed in Edmonds’algorithm) by

$$\begin{aligned} \widehat{yz}(uv)=y'\{u,v\} + z\{ B:u,v\in B\in \Omega \}. \end{aligned}$$

Here uv is an edge in a current shell S. To see this is correct consider a blossom \(B\in \Omega ^-\). If B contains both u and v \(y'(u)\) and \(y'(v)\) contribute a total of \(z(B)/2 +z(B)/2=z(B)\) to the right-hand side, as desired. If B contains only one of uv, say u, then blossom B dissolves before ShellSearch \((S)\), so \(y'(u)\) correctly includes the contribution of z(B)/2 to y(u).

Further details depend on the phase.

1.1 B.1 Phase 1

The list \({{\mathcal {A}}}\) is implemented using buckets B[i], \(1\le i\le |Q|\), where B[i] contains the atomic shells of size i that contain \(\ge 1\) free vertex.

The rematch step of Phase 1 computes a maximal set of disjoint augmenting paths using the algorithm of Gabow and Tarjan [12, 15] for ordinary matching, and Gabow [9] for f-factors. Both run in linear time O(m).

1.2 B.2 Phase 2

We use a priority queue PQ of \(c|Q|\log |Q|\) buckets. An entry PQ[t] is a list of the events of Phase 2 that are predicted to occur in the tth dual adjustment of the current shell S being searched.

To keep the space linear O(n), PQ is divided into \(c\log n\) “pages” of n buckets. Only the current page is implemented as an array of n buckets. The other pages are simply lists of events scheduled for time units in that page.

An event in PQ[t] is either a step of Edmonds’ search in the current shell S, or a shell boundary \(S^-\) or \(S^+\) that will dissolve in time unit t. When such a boundary dissolves, merging S with an adjacent shell \(S'\), we scan the adjacency list of each vertex \(v\in S'\). This entails adding new Edmonds events to PQ, and possibly executing Edmonds events that occur in the current time unit. In particular new search trees are added for free vertices in \(S'\).

The adjacency lists scans use total time O(m) per augment. as desired for our time bound. (In addition a scan may occur in a search whose shell eventually gets deactivated, again within our time bound.)

C The f-Factor Algorithm

The LP for f-factors is similar to matching (Appendix A), incorporating the degree constraint function f and I-sets of blossoms. (It is derived in [10]. Alternatively it follows from Schrijver [24, Theorem 33.2] by increasing edge weights by a large amount). We allow the graph to have parallel edges. Each copy of an edge has its own x variable indicating membership in the f-factor. Recall \(\gamma (v)\) is the set of all loops at v.

Maximize \(\sum _{e\in E} w(e)x(e)\) subject to

$$\begin{aligned} \begin{array}{llll} x(\delta (v))+2x(\gamma (v))&{}=&{}f(v)&{}\forall v\in V\\ x(\gamma (B) \cup I )&{}\le &{} \lfloor {f(B)+|I|\over 2} \rfloor &{}\forall B\subseteq V,\, I\subseteq \delta (B)\\ x(e)&{}\le &{} 1&{}\forall e\in E\\ x(e)&{}\ge &{} 0&{}\forall e\in E \end{array} \end{aligned}$$

We call e dominated, tight, or underrated depending on whether \(\widehat{yz}(e)\) is \(\ge w(e)\), \(= w(e)\), or \(\le w(e)\), respectively; strictly dominated and strictly underrated refer to the possibilities \(>w(e)\) and \(< w(e)\) respectively.

The dual LP uses dual functions \(y:V \rightarrow {\mathbb {R}}\), \(z:2^V \times 2^E\rightarrow \mathbb {R_+}\). Define \(\widehat{yz}:E\rightarrow {\mathbb {R}}\) by

$$\begin{aligned} \widehat{yz}(e) = y(e) + z\{ (B,I):e \in \gamma (B)\cup I \}. \end{aligned}$$
(C.1)
$$\begin{aligned} \begin{array}{lllll} \hbox {minimize }&{}{\sum }_{v\in V} f(v)y(v) &{}+&{} {\sum }_{B\subseteq V,I\subseteq \delta (B)} \lfloor {f(B)+|I|\over 2} \rfloor \, z(B,I) +u(E) \hbox { subject to}\\ &{}\widehat{yz}(e) +u(e)&{}\ge &{} w(e)\quad \forall e\in E\\ &{}u(e)&{}\ge &{} 0 \quad \forall e\in E\\ &{}z(B,I)&{}\ge &{} 0 \quad \forall B\subseteq V,\,I\subseteq \delta (B) \end{array} \end{aligned}$$

In the f-factor algorithm every nonzero z value has the form z(BI(B)) for B a mature blossom. So we write z(B) as a shorthand for z(BI(B)).

Gabow [10] treats f-factors by first generalizing algorithmic concepts from ordinary matching, and then modifying the matching procedure of Fig. 22 to apply to f-factors. We briefly review this presentation, referring the reader to [10] for a complete development.

We begin by defining f-factor blossoms. We start with some notation before giving the complete definition. We are given a graph G with degree constraints f(v), and a subgraph M (called a “matching”) with each \(d(v,M)\le f(v)\).Footnote 7 A blossom B is a subgraph of G. B has a base vertex \(\beta (B)\in V(B)\), denoted \(\beta \) if the blossom is clear. The subgraph B contains various matched edges but there may also be matched edges in \((\gamma (B) \cup \delta (B))-E(B)\). Every vertex \(v\in V(B)-\beta \) is perfectly matched, i.e., \(d(v,M)=f(v)\). The base vertex has \(d(\beta ,M)\ge f(\beta )-1\).

If \(d(\beta ,M)=f(v)\) then B has an associated base edge \(\eta (B)=\beta \beta '\), \(\beta '\notin V(B)\). B is a light blossom if \(\eta (B)\in M\) and a heavy blossom if \(\eta (B)\notin M\). (The light/heavy designations come from the \(e_B\) edges in the definition below.)

If \(d(\beta ,M)=f(\beta )-1\) the blossom is free. A free blossom has \(\eta (B)=\emptyset \) in the formal definition. But for the purpose of defining blossoms it is convenient to add an artificial edge \(\beta \beta '\) incident to B, call it matched, and set \(\eta (B)=\beta \beta '\). So a free blossom is light.

The following inductive definition of a blossom is taken from Gabow [10], with minor changes that incorporate the above notation. Figure 23 partially illustrates the definition.

Definition C.1

Let \(\overline{G}\) be a graph derived from G by contracting a family \({{\mathcal {A}}}\) of zero or more vertex-disjoint blossoms. A vertex of \(\overline{G}\) but not \({{\mathcal {A}}}\) is an atom. Let C be a closed path in \(\overline{G}\) that starts and ends at a vertex \(\alpha \) of \(\overline{G}\). The preimage of C in G is a blossom B with base vertex \(\beta \) if C has the following properties:

If \(\alpha \) is an atom then \(\alpha =\beta (B)\). C starts and ends with two edges \(e_B\) incident to \(\beta \) that are both matched in a heavy blossom, both unmatched in a light blossom.

If \(\alpha \in {{\mathcal {A}}}\) then \(\beta (B)=\beta (\alpha )\). The \(e_B\) edges are also those of \(\alpha \).

If v is an atom of \(C-\beta \) then the two edges of \(\delta _C(v) \) alternate.

If \(v\in {{\mathcal {A}}}\cap C-\alpha \) then \(\eta (v)\in \delta _C(\beta (v))\).

The closed path C is denoted C(B) if the blossom needs to be specified. The subgraph of B, denoted (V(B), E(B)), is a subgraph of G consisting of the subgraphs of all subblossoms \({{\mathcal {A}}}\) of B plus the atoms of B and the edges of C(B). We sometimes treat B as just the vertex set V(B).

A key property of blossoms is that every vertex \(v\in V(B)\) has two alternating trails from v to \(\beta \): \(P_0(v,\beta )\) which has even length and \(P_1(v,\beta )\) which has odd length. Each \(P_i\) is contained in B’s subgraph, \(E(P_i)\subseteq E(B)\). The \(P_i\)’s are recursively defined: For every blossom \(A\in {{\mathcal {A}}}\) containing a vertex of \(P_i\), \(E(P_i)\cap E(A)\) is some trail \(P_{i'}(v', \beta (A))\), and \(P_i\) contains \(\eta (A)\) unless \(\beta (A)= \beta \). (\(P_{i'}\) may occur in reverse order in \(P_i\).) The definition easily gives this generalization:

For every blossom \(A\not \ni \beta \), \(P_i(v,\beta )\) contains \(\eta (A)\) if it contains any vertex of A.

One of the trails \(P_0, P_1\) starts with a matched edge, the other starts with an unmatched edge. Both trails end with an \(e_B\) edge with one exception, \(P_0(\beta ,\beta )\) has length 0. \(P_1(\beta ,\beta )\) is nonsimple, it contains both \(e_B\) edges. So any \(P_i(v,\beta )\) extended with the edge \(\eta (B)\) is still an alternating trail. (In 1-matching, blossoms are always light. The \(P_0\) are required to be paths, and \(P_1\) paths need not exist.)

A blossom B has an associated set

$$\begin{aligned} I(B)=\delta _M(B)\oplus \eta (B). \end{aligned}$$

(A free B has \(I(B)=\delta _M(B)\oplus \emptyset =\delta _M(B)\).) These sets play the role of I in the above LP, i.e., instead of writing z(BI) we denote z duals as z(B) and define

$$\begin{aligned} \widehat{yz}(e) = y(e) + z\{ B:e \in \gamma (B)\cup I(B) \}. \end{aligned}$$

Although Fig. 23 draws I(B) edges as directed, an edge xy may belong to both \(I(B_x)\) and \(I(B_y)\).

The f-factor algorithm constructs a search forest analogous to matching.

The roots of the forest are the free blossoms and free atoms (vertices with \(d(v,M)<f(v)\)). For a nonroot node v of the forest, \(\tau (v)\) denotes the first edge of the path from v to its root. As in matching we say an edge \(xy\notin {\overline{\mathcal {S}}}\) alternates with node \(x\in {\overline{\mathcal {S}}}\) if xy can be added to the forest, i.e., there is an alternating path of edges of G that starts with xy. If x is in a contracted blossom the path includes \(P_i(x,\beta )\), where i is chosen so \(P_i\) starts with an edge alternating with xy. The classification of nodes as inner and outer is illustrated in Fig. 23. (In 1-matching possibilities (c) and (f) do not exist and there are no I(B) edges.)

Fig. 23
figure 23

The six types of nodes v in a search forest. ac are outer nodes and df are inner nodes. Edges drawn heavy are matched, light edges are unmatched. As labelled in (a), \(\tau (v)\) edges are always drawn above v and edges alternating with v are always drawn below v. (They need not be in the search forest.) \(\tau (v)\) does not exist for a search forest root, which has the form of either (a) or (b). For blossoms, the two \(e_B\) edges are always shown. Edges in I(B) sets are drawn directed to blossom B. In e and f \(\tau (v)\) can be matched or unmatched

We turn to the f-factor algorithm. As in matching the search forest is rooted at every free atom and free blossom. Eligibility is defined exactly as in matching. Pseudocode for a search is the same as matching Fig. 22 except for new versions of the blossom step, the Expand routine, and minor changes to AdjustDuals, all given in Fig. 24.

Fig. 24
figure 24

Search of the f-factor algorithm: The pseudocode that differs from Edmonds’ search

Figure 25 illustrates a simple execution of the algorithm. It shows that the baseless blossoms treated in the compression step of our algorithm (Fig. 15) can actually be formed.

Fig. 25
figure 25

Search steps leading to a baseless blossom. At the start of the search the solid edges are eligible. The ineligible edges \(e_i\) have \(\widehat{yz}(e_i)=y(e_i)=w(e_i)+\Delta (e_i)\). a The search begins by forming outer blossom B with unmatched base edge \(\eta (B)\). b If \(0<\Delta (e_1)<\Delta (e_2)\), duals are adjusted by \(1+\Delta (e_1)/2\). An augmenting path through B is found and the matching is augmented. c If \(0<\Delta (e_2)<\Delta (e_1)\), duals are adjusted by \(1+\Delta (e_2)/2\). An augmenting path of one edge is found and the matching is augmented

We conclude with a property closely related to the tightening step of our algorithm (Fig. 15). Consider a blossom \(B_u\) with base edge \(\eta (B_u)=uv\). \(\eta (B_u)\) is eligible if \(B_u\) is in a larger blossom with a different base vertex. This need not hold if u is the base of a maximal blossom, say B. To illustrate assume B is not in the search tree. If uv is unmatched and v is an inner vertex, dual adjustments increase \(\widehat{yz}(uv)\). If uv is matched and v is an outer atom or v is in an inner blossom, dual adjustments decrease \(\widehat{yz}(uv)\).

The following lemma identifies another configuration where uv is always eligible. We do not use the lemma in the main body of the paper—it is included for completeness, as well as illustrating the execution of the algorithm. Also for completeness we prove the lemma for duals that are optimum as well as near optimum. An \(\eta \) pair is an edge uv with \(uv=\eta (B_u)=\eta (B_v)\).

Lemma C.1

At any point in the f-factor algorithm, an \(\eta \) pair e has \(\widehat{yz}(e)=w(e)+\Delta \) where

$$\begin{aligned} \Delta \ {\left\{ \begin{array}{ll} =0 &{}\text {for optimum duals}\\ \in [-2,0] &{}\text {for near-optimum duals.} \end{array}\right. } \end{aligned}$$

Proof

The condition \(uv=\eta (B_u)=\eta (B_v)\) becomes satisfied in a blossom step that creates one of the blossoms \(B_u\), \(B_v\), or in an expand step that changes B from inner to outer, or in an augment step that makes uv an \(\eta \) pair. In all cases uv is eligible, so \(\Delta \) has the claimed value.

Suppose a dual adjustment step changes \(\Delta \). Clearly u and v must be in different maximal blossoms, and at least one of those blossoms is in the search structure. Let B (\(B'\)) be the maximal blossom containing u (v) respectively, and wlog assume B enters the search structure before \(B'\). B enters in a grow step for an edge xy with , \(xy\ne uv\). So B is an inner vertex (Fig. 23e or f).

We will show the dual adjustment maintains \(\Delta \) as claimed in the lemma. First suppose the algorithm is using optimum duals. uv is eligible, so a grow step for uv adds \(B'\) to the search structure as an outer vertex (Fig. 23b or c). The subsequent dual adjustment changes duals by

$$\begin{aligned}{} & {} y(u)\leftarrow y(u)+\delta , \quad z(B)\leftarrow z(B)-\delta \\{} & {} y(v)\leftarrow y(v)-\delta , \quad z(B')\leftarrow z(B')+\delta . \end{aligned}$$

The changes in y cancel each other. The changes in z do not change \(\widehat{yz}(uv)\) when uv is matched (since \(uv\notin I(B)\cup I(B')\) and z is irrelevant) or unmatched (since \(uv\in I(B)\cap I(B')\) and the changes in z cancel).

Suppose the algorithm is using near optimum duals. If uv is eligible the analysis for optimal duals applies. Suppose uv is ineligible. The dual adjustment changes y(u) and z(B) as above. If uv is matched then \(uv\notin I(B)\) so \(\widehat{yz}(uv)\) increases. \(\Delta \) increases from an initial value \(<0\), so the lemma’s condition is preserved. If uv is unmatched then \(uv\in I(B)\) so \(\widehat{yz}(uv)\) decreases. \(\Delta \) decreases from an initial value \(>-2\), so the lemma’s condition is preserved. \(\square \)

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Gabow, H.N. A Weight-Scaling Algorithm for f-Factors of Multigraphs. Algorithmica 85, 3214–3289 (2023). https://doi.org/10.1007/s00453-023-01127-x

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00453-023-01127-x

Keywords

Navigation