Packing of mixed hyperarborescences with flexible roots via matroid intersection

Given a mixed hypergraph $\mathcal{F}=(V,\mathcal{A}\cup \mathcal{E})$, functions $f,g:V\rightarrow \mathbb{Z}_+$ and an integer $k$, a packing of $k$ spanning mixed hyperarborescences is called $(k,f,g)$-flexible if every $v \in V$ is the root of at least $f(v)$ and at most $g(v)$ of the mixed hyperarborescences. We give a characterization of the mixed hypergraphs admitting such packings. This generalizes results of Frank and, more recently, Gao and Yang. Our approach is based on matroid intersection, generalizing a construction of Edmonds. We also obtain an algorithm for finding a minimum weight solution to the above mentioned problem.


Introduction
The purpose of this article is to generalize a recent result of Gao and Yang on packing mixed arborescences with flexible roots from mixed graphs to mixed hypergraphs using matroid intersection. This also yields a weighted algorithm for the corresponding problem.
In order to understand the introduction, the reader may find all the necessary definitions in Section 2.
The most basic setting when dealing with arborescence packings is the following one: Given a directed graph D = (V, A) and a multiset R of vertices in V , we want to find a packing {B r : r ∈ R} of spanning rarborescences. The following result was proven by Edmonds in 1973 in [3] and is fundemental to the theory of arborescence packings. It gives a complete characterization for the existence of packings of spanning arborescences with fixed roots in the basic setting. Another celebrated achievement of Edmonds is a connection between the theory of spanning arborescence packings in digraphs and matroid theory. For that, he considers two matroids on the arc set A of D. The first matroid M 1 is the k-sum of the forest matroid of the underlying graph of D where k = |R|. In other words, an arc set is independent in M 1 if the corresponding edge set can be partitioned into k forests. The second matroid M 2 is the direct sum of the uniform matroids of rank k − |R ∩ v| on the set δ − A (v) of arcs entering v for all v ∈ V . We refer to these matroids as the k-forest matroid and the (k, R)-partition matroid of D, respectively. Edmonds proved in [4] that the arc sets of a packing of spanning arborescences with respect to the root set R are exactly the common independent sets of M 1 and M 2 . The following observation which can simply be obtained from Theorem 1 is crucial for this modeling. It can be found as Theorem 13.3.20 in [11]. It can also be found as Lemma 5.4.6 in [8], where a direct proof is provided.
Theorem 2. Let D = (V, A) be a digraph and R a multiset of V of size k. Some A ′ ⊆ A is the arc set of a packing {B r : r ∈ R} of spanning r-arborescences in D if and only if the underlying edge set of A ′ is the edge set of a packing of k spanning trees and d − A ′ (v) = k − |R ∩ v| for all v ∈ V . A first way of generalizing the results obtained in the basic setting is the consideration of directed hypergraphs instead of digraphs. The following generalization of Theorem 1 was proved in a stronger form by Frank, Király and Király in [9].
Theorem 3. Let D = (V, A) be a dypergraph and R a multiset in V. There exists a packing {B r : r ∈ R} of spanning r-hyperarborescences in D if and only if d − A (X) ≥ |R − X| for all ∅ = X ⊆ V. We can conclude the following statement from Theorem 3 using the same technique that was used in [11] to conclude Theorem 2 from Theorem 1. We therefore omit the proof.
The above idea of approaching the problem of packing spanning arborescences via matroid intersection is useful for two reasons. On the one hand, one can apply Edmonds' matroid intersection theorem [2] to get the characterization for the existence of the packing. On the other hand, one can apply Edmonds' weighted matroid intersection algorithm [5] to find a packing of minimum total weight. These results of Edmonds are presented in the following theorem.
Theorem 5. Let M 1 = (S, r 1 ) and M 2 = (S, r 2 ) be two matroids on a common ground set S with polynomial independence oracles for M 1 and M 2 being available, µ a positive integer and let w : S → R be a weight function.
(a) [2] A common independent set of size µ of M 1 and M 2 exists if and only if r 1 (Z) + r 2 (S − Z) ≥ µ for all Z ⊆ S.
(b) [5] We can decide if a common independent set of size µ of M 1 and M 2 exists in polynomial time. Further, if this is the case, then one of minimum weight can be computed in polynomial time.
Giving a similar characterization in terms of matroid intersection for arborescence packings in a more general setting is the main purpose of this article.
Firstly, the generalization concerns mixed hypergraphs instead of digraphs. Secondly, the generalization relaxes the condition of the roots of the arborescences being fixed. We are given a mixed hypergraph H = (V, A ∪ E), a non-negative integer k and functions f, g : V → Z ≥0 , and we want to find a packing of k spanning mixed r i -hyperarborescences {B i : i ∈ {1, . . . , k}} such that every vertex v ∈ V is the root of at least f (v) and at most g(v) of the k hyperarborescences. We call such a packing (k, f, g)-flexible. The digraphic case of this problem has been successfully treated by Frank in [7]. He gave both a theorem characterizing the digraphs admitting a (k, f, g)-flexible packing for given k, f, g and an algorithm to find such a packing if it exists. Recently, this has been generalized to the case of mixed graphs by Gao and Yang in [12].
The basic insight of our approach is that, given a packing of k spanning arborescences, for every vertex v ∈ V , the number of arborescences in the packing whose root is v plus the in-degree of v in the packing is equal to k. We use this fact to show that (k, f, g)-flexible packings in mixed hypergraphs can be modeled as the intersection of two matroids. While a hypergraphic analogue of the k-forest matroid is maintained as one of the two matroids, the (k, R)-partition matroid is replaced by a more general object, a so-called generalized partition matroid. Using Theorem 5(a), this allows to obtain the following characterization for (k, f, g)-flexible packings in mixed hypergraphs which is the main contribution of this article. It generalizes the theorem of Gao and Yang. Our proof is completely different from the one in [12] and works for mixed hypergraphs.
for every subpartition P of V.
While the technique of matroid intersection for arborescence packings is routinely used as a tool to obtain algorithms for the weighted cases, this is to our best knowledge the first time that a new structural result is obtained via matroid intersection. By Theorem 5(b), the previous observation also yields an algorithm to compute a (k, f, g)-flexible packing of minimum total weight in polynomial time.

Definitions
For some directed graph (in short, digraph) D = (V, A) and r ∈ V , an r-arborescence in D is a subgraph of D whose underlying graph is a tree and in which all the vertices except r have exactly 1 arc entering. An r-arborescence of D is called spanning if it contains all the vertices of D. By a packing of arborescences we mean a set of arc-disjoint arborescences. A multiset R is a collection of elements in which an element may appear several times. For some x ∈ R, we denote by |R ∩ x| the number of times x is contained in R.
A mixed hypergraph is a tuple F = (V, A∪E) where V is a set of vertices, A is a set of directed hyperedges (dyperedges) and E is a set of hyperedges. A dyperedge a is a tuple (tail(a), head(a)) where head(a) is a single vertex in V and tail(a) is a nonempty subset of V − head(a) and a hyperedge is a subset of V of size at least two.
For some X ⊆ V , we denote by δ E (X) the set of hyperedges e ∈ E with e ∩ X, e − X = ∅, by δ − A (X) the set of dyperedges a ∈ A with head(a) ∈ X, tail(a) − X = ∅. We use d E (X) for |δ E (X)| and d − A (X) for |δ − A (X)|. For a single vertex v, we use δ E (v) instead of δ E ({v}) etc. Given a function f : V → Z and X ⊆ V , we use the notation f (X) = v∈X f (v) and hence we consider f (∅) = 0.
For some A ′ ⊆ A and E ′ ⊆ E, we denote by V (A ′ ∪ E ′ ) the set of vertices in V which are contained in at least one dyperedge in A ′ or hyperedge in E ′ . A mixed hypergraph without hyperedges is a directed hypergraph (dypergraph) and a mixed hypergraph without dyperedges is a hypergraph. The underlying hypergraph H F = (V, E A ∪ E) of F is obtained by replacing every dyperedge a ∈ A by the hyperedge head(a) ∪ tail(a). For a hyperedge e ∈ E, its corresponding bundle A e is the set of all possible orientations of e, i.e.
and at most g(v) of the k hyperarborescences and for every e ∈ E, at most one dyperedge of the bundle A e is contained in the dyperedge set of the packing. We say that F is a mixed graph if each dyperedge has a tail of size exactly one and each hyperedge contains exactly two vertices.
Trimming a dyperedge a means that a is replaced by an arc uv with v = head(a) and u ∈ tail(a). Trimming a hyperedge e means that e is replaced by an arc uv for some u = v ∈ e. The mixed hypergraph H is called a mixed hyperarborescence if its dyperedges and hyperedges can be trimmed to get an arborescence. A mixed r-hyperarborescence for some r ∈ V is a mixed hyperarborescence together with a vertex r whose dyperedges and hyperedges can be trimmed to get an r-arborescence. A hypergraph is called a (spanning) hypertree if it can be trimmed to a (spanning) arborescence.
Given a packing B = {B r : r ∈ R} of mixed hyperarborescences, we use A(B) for ∪ r∈R A(B r ) and E(B) for ∪ r∈R E(B r ). Further, given a weight function w : Given a subpartition P of V , we use E(P) for ∪ X∈P δ E (X) and A(P) for ∪ X∈P δ − A (X). We use e E (P), e A (P), e E∪A (P) for the cardinality of E(P), A(P) and E(P) ∪ A(P), respectively. A hypergraph H = (V, E) is called partition-connected if e E (P) ≥ |P| − 1 for every partition P of V . Further, we use ∪P for the union of the classes of P.
Basic notions of matroids which are used in this article can be found in Chapter 5 of [11].

Relevant matroids
We now give an overview of the matroids we need for our characterization.

Hypergraphic matroids
While graphic matroids are well-studied, their generalization to hypergraphs has received significantly less attention. The following matroid construction was first observed by Lorea [13]. Given a hypergraph H = Theorem 8. The set I H is the set of independent sets of a matroid M H on E.
The matroid M H is called the hyperforest matroid of the hypergraph H. For our algorithmic result, we need to show that an independence oracle for M H exists. In order to do so, we require the following two preliminaries. The first result can be found as Corollary 2.6 in [10].
This result is useful due to the next one which can be found in [11] as a comment after Theorem 9.1.22 stating that the proof of Theorem 9.1.15 is algorithmic.
There is a polynomial time algorithm that decides whether a given hypergraph H is partitionconnected.
We are now ready to conclude that a polynomial time independence oracle for M H exists. Proof. If |Z| ≥ |V |, it follows immediately from the definition of M H that Z is dependent in M H . We may hence suppose that |Z| ≤ |V | − 1. Let a hypergraph H ′ be obtained from (V, Z) by adding a set S of |V | − 1 − |Z| hyperedges each of which equals V . Observe that |Z ∪ S| = |V | − 1.
By Claim 1 and as H ′ can be constructed efficiently, it suffices to check whether H ′ is partition-connected. By Proposition 2, this can be done in polynomial time.
We also need the k-sum matroid of M H , that is the matroid on ground set E in which a subset of E is independent if it can be partitioned into k independent sets of M H . We call this matroid k-hyperforest matroid and refer to it as M k H . The following formula for the rank function of M k H was proved by Frank, Király and Kriesell [10].
: P a partition of V }. We now extend the previous construction to mixed hypergraphs.
replacing every e ∈ E by |e| parallel copies of itself, associating these elements to the dyperedges in A e and associating every element of E A to the corresponding element in A. We give the following formula for the rank function of Proof. Let Z ′ be obtained from Z by deleting all but one element of Z ∩ A e for all e ∈ E with |Z ∩ A e | ≥ 2.

As all elements in
H , is a restriction of M k F and whose ground set contains Z ′ . It follows from Theorem 9 that r M k Again, for the algorithmic part, we need to show that an independence oracle for M k F is available. We need the following preliminary result on matroids which was proven by Edmonds [1]. Lemma 2. Given a mixed hypergraph F = (V, A ∪ E) and Z ⊆ A ∪ A E , we can decide in polynomial time if Z is independent in M k F . Proof. If Z contains at least 2 elements of A e for some e ∈ E, then Z is dependent in M k F by definition. Otherwise, there is a matroid M ′ that is isomorphic to M k HF , is a restriction of M k F and whose ground set contains Z. Further, M ′ can be found efficiently. It therefore suffices to prove that a polynomial time independence oracle for M k HF is available. This follows immediately from Lemma 1 and Proposition 4.

Generalized partition matroids
The other matroid we consider is called a generalized partition matroid and plays the role of the (k, R)partition matroid. It has been considered in a slightly weaker form in [11], see Problem 5.3.4.
Let {S 1 , . . . ,S n } be a partition of a set S and µ, α i , β i ∈ Z for all i ∈ {1, . . . , n}. For Z ⊆ S and i ∈ {1, . . . , n}, let z i = |Z ∩ S i |. Let . . , n}, |Z| = µ} and for all Z ⊆ S. Theorem 10. There exists a matroid M whose set of independent sets is I, set of bases is B and rank function is r if and only if The matroid M in Theorem 10 is called generalized partition matroid.
Proof. First suppose that M is a matroid and let Z ∈ B. For all i ∈ {1, . . . , n}, this yields max{α We now show sufficiency through three claims.
Claim 2. I forms the collection of independent sets of a matroid M, i.e. I satisfies the following 3 independence axioms: In order to prove that Z j ∈ I for some j ∈ J, it remains to show that there is some j for all i ∈ {1, . . . , n}. As |Z| < |Z ′ | and Z ′ ∈ I, for some arbitrary j ∈ J we obtain

Claim 3. Z ∈ B if and only if Z is a maximal element in I.
Proof. First let Z ∈ B. We obtain µ = |Z| = n i=1 z i = n i=1 max{α i , z i }. As β i ≥ z i for all i ∈ {1, . . . , n}, we have Z ∈ I. Further, for any proper superset Z ′ of Z, we have It follows that Z is maximally in I. Now let Z be a maximal element in I. If z j < α j for some j ∈ {1, . . . , n}, let x ∈ S j − Z and let Z ′ = Z ∪ {x}. As α j ≤ β j and Z ∈ I, we obtain z ′ This contradicts the maximality of Z. We obtain that z j ≥ α j for all j ∈ {1, . . . , n}.
If |Z| < µ, by This contradicts the maximality of Z. It follows that Z ∈ B.

Claim 4. The rank function of M is r.
Proof. Let Z ⊆ S and Y be a maximal element of I in Z.
, so we are done. We may hence suppose that J = ∅. For all j ∈ J, let x j ∈ (S j ∩ Z) − Y and let Y j = Y ∪ {x j }. Observe that for all j ∈ J, we have y j j = y j + 1 ≤ min{z j , β j } and y j i = y i ≤ min{z i , β i } for all i ∈ {1, . . . , n} − {j}. If n i=1 max{α i , y i } < µ, then for some arbitrary j ∈ J, we have n i=1 max{α i , y j i } ≤ n i=1 max{α i , y i } + 1 ≤ µ, so Y j ∈ I, a contradiction to the maximality of Y . This yields n i=1 max{α i , y i } = µ. If there is some j ∈ J such that y j < α j , then n i=1 max{α i , y j i } = n i=1 max{α i , y i } = µ, so Y j ∈ I, a contradiction to the maximality of Y . This yields y j ≥ α j for all j ∈ J, so, as y j ≤ z j , we obtain max{α j − y j , 0} = 0 = max{α j − z j , 0}. For all i ∈ {1, . . . , n} − J, we have either y i = β i or y i = z i . If The three previous claims yield the theorem.
be a directed hypergraph and f, g : V → Z + integer functions such that the following two conditions are satisfied: (7) and (8) coincide with (5) and (6), respectively. We can therefore apply Theorem 10 from which the statement follows immediately.
The following is an immediate corollary of the definition of M

Flexible packings by matroid intersection
We are now ready to show how to model packings of spanning mixed hyperarborescences with flexible roots via matroid intersection.
The following observation allows us to reduce the problem of flexible packings in a mixed hypergraph to finding feasible packings in its directed extension. We now give the characterization via matroid intersection which is the core of this article. Theorem 11. Let F = (V, A∪E) be a mixed hypergraph, D F = (V, A ′ = A∪A E ) its directed extension, f, g : V → Z + integer valued functions and k ∈ Z + . Suppose that (7) and (8)  Proof. For the sake of simplicity, we use M 1 and M 2 for M k F and M (k,f,g) DF , respectively. As (7) and (8) are satisfied, Corollary 1 yields that M 2 is well-defined. First, let Z be the dyperedge set of a (k, f, g)-feasible packing in D F . Then the underlying undirected hypergraph of (V, Z) is the union of k hyperedge-disjoint spanning hypertrees and Z contains at most one dyperedge of the bundle A e for all e ∈ E. It follows that Z is an independent set of M 1 . As Z is the dyperedge set of a packing of k spanning hyperarborescences, we have |Z| = k(|V | − 1). Since the packing is (k, f, g)-feasible, every vertex v is the root of at least f (v) and at most g(v) of the k spanning hyperarborescences of the packing. It follows that Now let Z be a common independent set of M 1 and M 2 of size k(|V | − 1). Then, by f ≥ 0, the underlying hypergraph of (V, Z) is the union of k hyperedge-disjoint spanning hypertrees and d − Theorem 4 therefore implies that Z is the set of dyperedges of the union of k dyperedge-disjoint spanning hyperarborescences with root set R, so each v ∈ V is the root of k − d − Z (v) of them. As Z is an independent set of M 2 , we obtain that . Finally, as Z is independent in M 1 , Z contains at most one dyperedge of the bundle A e for all e ∈ E. It follows that Z is the dyperedge set of a (k, f, g)-feasible packing in D F .

The proofs of Theorems 6 and 7
This section is dedicated to concluding Theorems 6 and 7 from the matroidal characterization found in Theorem 11. We first need two slightly technical lemmas. The first one shows the necessity in Theorem 6 and is also used in the proof of Theorem 7. Proof. By (2) for P = ∅ and f ≥ 0, we obtain This yields the first inequality of (8).
Note that any element in E(P) ∪ A(P) provides at least one dyperedge in A ′ entering a vertex in V − V ′′ . Hence, by (2), we obtain It follows that the second inequality of (8) is satisfied.
We now show that Theorems 11 and 5(a) imply Theorem 6.
Proof of Theorem 6. Necessity is proved in Lemma 5. To see sufficiency, suppose that (1), (2) and (3) are satisfied. Let D F = (V, A ′ = A ∪ A E ) be the directed extension of F . By Lemma 6, (7) and (8)  , respectively. Suppose for a contradiction that no (k, f, g)-flexible packing of mixed hyperarborescences exists in F . By Lemma 4, no (k, f, g)-feasible packing of hyperarborescences exists in D F . Now Theorem 11 implies that M 1 and M 2 do not have a common independent set of size k(|V | − 1). The next result allows to fix a certain structure leading to a contradiction later.
Claim 5. There exist a partition P of V and K ⊆ E(P) such that Proof. As M 1 and M 2 do not have a common independent set of size k(|V | − 1), Theorem 5(a) implies that there exists a dyperedge set Z ′ ⊆ A ′ such that k(|V | − 1) > r M1 (Z ′ ) + r M2 (A ′ − Z ′ ). By Proposition 3, there exists a partition P of V such that, for K = {e ∈ E(P) : Z ′ ∩ A e = ∅}, we have r M1 (Z ′ ) = |Z ′ ∩ A(P)| + |K| + k(|V | − |P|). By subcardinality and monotonicity of r M2 , we have The above three inequalities yield Let P be the partition of V and K the hyperedge set from Claim 5 and let Z= A(P) ∪ A E(P)−K . For some X ∈ P, a dyperedge a ∈ A ∪ A E−K contributes to either of v∈X d − Z (v) and d − A∪AE−K (X) if and only if head(a) ∈ X and tail(a) − X = ∅. This yields For all P ′ ⊆ P, as every hyperedge in E(P ′ ) contributes to one of |K| and X∈P ′ d − AE−K (X), we have Using Corollary 1, we distinguish two cases depending on where the rank of Z in M 2 is attained.
The case distinction is complete which finishes the proof of Theorem 6.
Finally, we deal with the algorithmic consequences of Theorem 11 which are contained in Theorem 7.
Proof of Theorem 7. It can be checked efficiently whether (7) and (8) are satisfied. If not, then, by Lemma 6, one of (1), (2) and (3)  (k,f,g) DF are available by Lemmas 2 and 3. Now consider the subdypergraph D * = (V, A * ) of D F and let R be the multiset in V in which every v ∈ V is contained k − d − A * (v) times. By Theorem 9(a) in [6], A * can be decomposed into the dyperedge set of a packing of spanning hyperarborescences with root set R in polynomial time. Replacing dyperedges in A e by e for all e ∈ E, we obtain, by Lemma 4, the desired packing in F .