Efficient Theoretic and Practical Algorithms for Linear Matroid
Total Page:16
File Type:pdf, Size:1020Kb
Journal of Computer and System Sciences 1273 journal of computer and system sciences 53, 129147 (1996) article no. 0054 CORE Efficient Theoretic and Practical AlgorithmsMetadata, for citation and similar papers at core.ac.uk Provided by Elsevier - Publisher Connector Linear Matroid Intersection Problems Harold N. Gabow* and Ying Xu Department of Computer Science, University of Colorado at Boulder, Boulder, Colorado 80309 Received February 1, 1989 This paper presents efficient algorithms for a number Efficient algorithms for the matroid intersection problem, both car- of matroid intersection problems. The main algorithm is dinality and weighted versions, are presented. The algorithm for for weighted matroid intersection. It is based on cost weighted intersection works by scaling the weights. The cardinality scaling, generalizing recent work in matching [GaT87], algorithm is a special case, but takes advantage of greater structure. Efficiency of the algorithms is illustrated by several implementations on and network flow [GoT]. A special case is of this problem linear matroids. Consider a linear matroid with m elements and rank n. is cardinality matroid intersection, and several improve- Assume all element weights are integers of magnitude at most N. Our ments are given for this case. The efficiency of our fastest algorithms use time O(mn1.77 log(nN)) and O(mn1.62) for intersection algorithms is illustrated by implementa- weighted and unweighted intersection, respectively; this improves the tions on linear matroids. This is the broadest class of previous best bounds, O(mn2.4) and O(mn2 log n), respectively. Corresponding improvements are given for several applications of matroids with efficient representations. (Implementations of matroid intersection to numerical computation and dynamic systems. our general matroid algorithm on other matroids are given ] 1996 Academic Press, Inc. in [GX].) To state the specific results, assume that a linear matroid is given consisting of m elements with dimension n. For 1. INTRODUCTION weighted intersection assume that all weights are integers at most N in magnitude. We distinguish two types of The matroid intersection problem is interesting from a algorithms: those that use only naive procedures for theoretic point of view and because of its rich set of applica- manipulating matrices (e.g., the simple O(n3) algorithm for tions. Concerning theory, matroid intersection generalizes matrix multiplication) and those that take advantage bipartite graph matching; powerful duality results (e.g., the of sophisticated procedures (e.g., the O(n2.4) multiplica- KonigEgervary minimax theorem) generalize to matroids tion algorithm of [CW]). Algorithms of the first type do (e.g., Edmonds' matroid intersection theorem) [L]. Concer- not have as good an asymptotic time bound. However, they ning applications, matroid intersectioncanbeusedto analyze can be more practical than algorithms of the second type, continuous systems arising in electrical networks, elastic which have large constants hidden in the asymptotic structures, and chemical processing plants. The analysis is bounds. attractive because problems that might naturally be solved by The main previous contribution for linear matroids is the numerical computation, subject to rounding error and inac- cardinality intersection algorithm of Cunningham [Cu]. It curacies in the data, are replaced by discrete calculations, finds a maximum cardinality matching on a linear matroid which are more efficient and relatively insensitive to these in time O(mn2 log n), using naive matrix manipulation. Our numerical difficulties. Examples of such applications of naive algorithm for cardinality intersection is essentially the matroid intersection include solvability and dynamic degrees same as Cunningham's. Using fast matrix multiplication our of freedom of an electrical network [I] and their generaliza- algorithm runs in time O(mn1.62). tiontoarbitrary dynamicsystemsgovernedby lineardifferen- For the weighted problem, our naive algorithm finds a max- tial equations [M87a]. (For electrical networks the matroids imum weight perfect matching in time O(mn2 log n log(nN)). tend to be graphic; for general systems they are linear. This bound is just a factor log(nN) more than Cunningham's Applications are discussed further in Section 5.) bound for the simpler problem without weights. Using fact 1.77 * Research supported in part by NSF Grant Nos. MCS-8302648, matrix multiplication our algorithm runs in time O(mn DCR-851191. log(nN)). The previous best bound for this problem is 129 0022-0000Â96 18.00 Copyright 1996 by Academic Press, Inc. All rights of reproduction in any form reserved. File: 571J 127301 . By:BV . Date:29:08:96 . Time:11:51 LOP8M. V8.0. Page 01:01 Codes: 6104 Signs: 4603 . Length: 60 pic 11 pts, 257 mm 130 GABOW AND XU achieved by Frank's algorithm [F] (and a number of similar because of repeated matrix multiplications and inversions. algorithms). This gives time O(mn3) using naive multiplica- Hence the bounds either assume we are working over a tion and O(mn2.4) using fast multiplication. Frank's algo- finite field, or the bounds count the number of arithmetic rithm has the theoretic advantage that the time bound is operations. strongly polynomial. (Advantages and disadvantages of I denotes the identity matrix. The dimension of this strong polynomial algorithms compared to scaling algo- matrix will be clear from context. rithms are discussed in [G, GoT].) The reader is assumed familiar with the basic notions of It is interesting to compare our results with recent scaling matroids (see, e.g., [A, L, W]). Let M be a matroid over a algorithms for minimum cost network flow [GoT], the set of elements E. The span of a set of elements S is denoted assignment problem [GaT87], minimum weight matching sp(S). Suppose e is an element and B is a base. The notation [GaT88], and others. These papers present scaling algo- C(e, B) denotes the fundamental circuit of e in B if e  B,or rithms with a time bound for the weighted problem that is the fundamental cocircuit of e for B if e # B. (It will be clear essentially within a factor log(nN) of the best-known bound from context whether or not e # B.) On occasion we write for the (simpler) cardinality problem. As mentioned, this is C(e, B, M) if the matroid M is not clear. If S and T are sets also the case for our weighted matroid intersection algo- of elements then SÂT denotes the matroid restricted to S rithm using naive multiplication. However, using fast multi- with T contracted.IfMand N are matroids, their direct sum plication there is a much larger gap between our bounds for is denoted M+N. weighted and cardinality problems, about n0.15. We leave Let the element set E be partitioned into blocks of size open the problem of closing this gap, or making other two called pairs. Thus each element e has a mate, denoted eÄ , improvements to our algorithms. such that [e, eÄ ] is a pair. (We usually drop brackets and The rest of this section gives some terminology and denote a pair as e, eÄ .) A matching M is an independent set notation; then it sketches Frank's algorithm for weighted of pairs, i.e., e # M if and only if eÄ # M .Amaximum car- matroid intersection [F]. Our algorithm uses several dinality matching has the greatest number of pairs possible. ideas of this algorithm. Section 2 presents our algorithm A matching is perfect if it is a base of M.Ifw:EÄRis a for weighted matroid intersection, on general matroids. function that assigns a real-valued weight to each element, Section 3 gives the algorithm for cardinality matching, the weight of a set S of elements is defined as w(S)= plus other extensions of the weighted algorithm. Section 4 [w(e)|e#S].Amaximum perfect matching is a perfect gives implementations of the matching algorithms matching that has the largest weight possible. Maximum on linear matroids. Section 5 sketches the extensions weight maximum cardinality matching is defined similarly. A to related problems such as independent assignment maximum weight matching is a matching with the largest and linking (definitions of these problems are in weight possible. Section 5). It concludes by giving a number of applica- The above problems generalize the problem of matching tions to problems in numerical computation and dynamic on graphs. This paper is concerned with the ``bipartite'' systems. versions of these matching problems. Specifically, through- If S is a set and e an element, S+e denotes S _ [e] and out this paper the M is a direct sum of matroids, M=M0+ S&e denotes S&[e]. The symmetric difference of sets S M1 , where Mi is a matroid on elements Ei , i=0, 1 (so and T is denoted SÄT. We use interval notation for sets of E=E0 _E1) and every pair contains one element from each integers: for integers i and j,[i..j]=[k | k is an integer, matroid. The cardinality matroid intersection problem is to ik j],[i..j)=[k | k is an integer, ik< j], etc. The log find a maximum cardinality matching on such a matroid M. function denotes logarithm base two. We use the following The weighted matroid intersection problem is to find convention to sum the values of a function: If f is a real- either a maximum perfect matching, maximum weight max- valued function defined on elements and S is a set of imum cardinality matching, or maximum weight matching, elements, then f(S)=[f(s)|s#S]. on M. The algorithms for linear matroids do matrix multiplica- The following notation is useful in the context of intersec- tion. We could state the time bounds in terms of M(n), the tion problems. For any set of elements S and i # [0, 1], Si time to multiply two n_n matrices.