<p>This answer addresses the NP-hardness of the SPANNING SYMMETRIC HYPERFOREST ROOT SET (SSHRS) problem (given an undirected hypergraph $G$ and a number $k$, is there a spanning hyperforest with root set of size at most $k$ in the symmetric directed hypergraph $D_G$).</p>

<p>We prove that this problem is hard by reduction from the MAXIMUM UNIQUELY RESTRICTED BIPARTITE MATCHING (MURBM) problem (see <a href="https://link.springer.com/article/10.1007/s00453-001-0004-z" rel="nofollow noreferrer">https://link.springer.com/article/10.1007/s00453-001-0004-z</a> for hardness). A uniquely restricted matching in a graph $B$ is a matching $M$ such that the induced subgraph of $B$ over the vertices of $M$ has exactly one perfect matching ($M$ itself). The MURBM problem asks for a given bipartite graph $B$ and a given number $n$ whether there exist a uniquely restricted matching in the graph with at least $n$ edges. </p>

<p>Note that a matching is uniquely restricted if and only if there exists no cycle in the graph whose edges alternate between being in the matching and not being in the matching. (This is easy to show, so the proof will not be included here).</p>

<p>The reduction from MURBM to SSHRS is simple: we are given a MURBM instance consisting of bipartite graph $B$ and number $n$. Suppose $B$ has vertex parts $V_1$ and $V_2$. Define $N(v)$ to be the set of neighbors of $v$ in $B$. Then define a hypergraph $G = (V, E)$ with vertices $V = V_1$ and edges $E = \{N(v)~|~v\in V_2\}$. Next, define $k = |V_1| - n$. In other words, construct the hypergraph $G$ whose bipartite graph model is $B$. Output $G$ and $k$ as the SSHRS instance output of the reduction.</p>

<p>The logic behind the reduction is this: </p>

<p>Choosing a spanning hyperforest in $D_G$ is equivalent to choosing a set of edges in $D_G$ subject to certain constraints. But choosing a set of edges in $D_G$ (subject to certain constraints) is equivalent to choosing a set of edges in $G$ and choosing a vertex to be the head from each (subject to certain constraints). Since a hyperforest allows no cycles, the same edge of $G$ directed in different ways cannot be used (as two such "duplicate" edges form a cycle). Since in a hyperforest the vertices have max in-degree one, the same vertex cannot be chosen as the head of multiple different edges. In other words, the choice of edges in $G$ and heads of those edges that comprises a choice of spannning hyperforest is equivalent to the choice of a matching in the bipartite graph model of $G$ (subject to certain constraints). But by construction, the bipartite graph model of $G$ is exactly the bipartite graph $B$, so choosing a spanning hyperforest in $D_G$ is equivalent to choosing a matching in $B$ subject to certain constraints.</p>

<p>What are those constraints? Well a hyperforest cannot have any cycles, and must have vertex in-degrees of at most 1. The vertex in-degree constraint is already met by any matching, so the only constraint is to have no cycles. But a cycle in the hyperforest corresponds to a cycle in the bipartite graph model of $G$ such that every second edge is in the corresponding "matching". Thus, the cycle-free condition of the hyperforest is equivalent to the condition that there exists no cycle in the graph whose edges alternate between being in the matching and not being in the matching.</p>

<p>Thus, hyperforests in $G$ correspond to uniquely restricted matchings in $B$. All that's left is to show that the parameters also match: that having a hyperforest with root set size at least $k$ corresponds to having a matching of size at least $n$. Every vertex in a spanning hyperforest has in-degree either 0 or 1, so the number of in-degree-1 vertices is equal to the total in-degree in the spanning hyperforest. But the total in-degree is also equal to the number of edges since each edge has exactly one head. Thus, the number of in-degree-1 vertices in the spanning hyperforest is equal to the number of edges. We also know that the size of the matching equals the number of edges in the hyperforest. Thus the size of the matching equals the number of in-degree-1 vertices in the hyperforest. Furthermore, the number of roots is by definition the number of in-degree-0 vertices. Thus, the size of the root set plus the size of the matching is equal to the number of vertices $|V| = |V_1|$. Therefore, the hyperforest has root set size at most $k = |V_1| - n$ if and only if the matching has size at least $n$.</p>

CC BY-SA 3.0
2018-02-11T06:04:12.187Z
2018-02-11T06:04:12.187Z
Mikhail Rudoy
<h1>This answer is wrong (question has changed)</h1>

<p>This answer shows that the Spanning Hypertree Root Set problem is NP-hard, whereas the question now asks about the Spanning Hyperforest Root Set problem.</p>

<h2>Answer</h2>

<p>The $n$-uniform Hypergraph Spanning Tree Problem, which asks for a given undirected $n$-uniform hypergraph whether there exists a spanning hypertree, is NP-hard for any $n \ge 4$ (see <em>The Steiner tree problem: a tour through graphs,
algorithms, and complexity</em> by Hans Jürgen Prömel and Angelika Steger). </p>

<p>An undirected hypergraph has a spanning hypertree if and only if the corresponding symmetric directed hypergraph has a spanning hypertree. Furthermore, any spanning hypertree has a number of roots that is at most the number of vertices. Thus, there is an easy reduction from the $n$-uniform Hypergraph Spanning Tree Problem to the $n$-uniform Spanning Hhypertree Root Set problem: given an undirected hypergraph, set $D$ to be the corresponding symmetric directed hypergraph and set $k$ to be the number of vertices in the hypergraph.</p>

<p>Thus, your problem is NP-hard, even if the hypergraph is restricted to be be $n$-uniform for some $n \ge 4$.</p>

CC BY-SA 3.0
2018-01-25T23:47:55.720Z
You're right. I didn't read your definitions carefully enough and thought that the root is the head of an edge rather than the tail. I'll edit my answer so that it still works.
Mikhail Rudoy
CC BY-SA 3.0
2018-02-10T20:13:50.203Z
The $k=1$ case of my problem is easy to solve: simply iterate through all vertices, and see if they form the root of a spanning tree/forest in my sense. (Simply see if there are any edges whose tail is just that singleton, and forward-chain if so.) So I think that you must be thinking of another problem, different even than the previous version of my problem if you were to add the condition of connectedness.
Niel de Beaudrap
CC BY-SA 3.0
2018-02-11T02:41:47.110Z
Looks like when I edited this, I somehow ended up reverting my previous edit. Fixing now.
Mikhail Rudoy
CC BY-SA 3.0
2018-01-24T08:06:11.477Z
2018-02-11T02:41:36.090Z
2018-02-11T02:41:36.090Z
Mikhail Rudoy
<p>I am interested in the complexity of a problem involving spanning hyperforests (a union of hypertrees, which covers all of the vertices) of a $k$-hypergraph. I describe the relevant definitions for hypergraphs below, but the following is the problem on </p>

<blockquote>
  <p><strong>SPANNING HYPERFOREST ROOT SET.</strong> For a directed hypergraph $D$ and an integer $k \geqslant 1$, determine whether there exists a spanning hyperforest for $D$ which has a root-set of size at most $k$. </p>
</blockquote>

<p><strong>Remarks.</strong> </p>

<ul>
<li>It is not difficult to show that SPANNING&nbsp;HYPERFOREST&nbsp;ROOT&nbsp;SET is in <strong>NP</strong>: in particular, if a root-set of the suitable size is provided, then a spanning hyperforest with that root-set can be found in polynomial time.</li>
<li>It is also trivial to find a value of $k$ for which $(D,k)$ is a YES instance: for instance $k = \lvert V(D) \rvert$ (in which case the empty hypergraph is a spanning hyperforest with root set $k$).</li>
<li>Considered as an optimisation problem, it is usually easy to find values $k &lt; \lvert V(D) \rvert$ for which $(D,k)$ remain YES instances, though it is not clear how easily one can find the optimum.</li>
</ul>

<h2>Question.</h2>

<p>Is SPANNING&nbsp;HYPERFOREST&nbsp;ROOT&nbsp;SET also <strong>NP</strong>-hard? Is this true in the special case where the input hypergraph is "symmetric", in the sense that for any edge $e = (t(e), h(e))$ and for any $v \in s(e) := t(e) \cup h(e)$, there is also an edge $e' = (s(e) {\,\smallsetminus\,} \{v\}, v)$?</p>

<hr>

<p><strong>Relevant definitions.</strong></p>

<p>In the following, I am broadly following the definitions of "<a href="https://link.springer.com/article/10.1007/BF02614371" rel="nofollow noreferrer">Flows on hypergraphs</a>" [<a href="https://pdfs.semanticscholar.org/13cf/dff5b9389d3ca511caf9358fd2b3f13c0c11.pdf" rel="nofollow noreferrer">free PDF link</a>] by Cambini, Gallo, and Scutellà.</p>

<ul>
<li>A hypergraph is a pair $G = (V,E)$, where $E \subseteq \mathcal P(V)$. If each $e\in E$ has the same cardinality $k$, we call $G$ a $k$-uniform hypergraph (or $k$-hypergraph).</li>
<li>A directed hypergraph is a pair $D = (V,E)$, where in our setting we let $E \subseteq \mathcal P(V) \times V$ be the set of hyper-edges. For each edge $e \in E$, we let $t(e) = \pi_1(e) \subseteq V$ be the "tail" of the edge, and $h(e) = \pi_2(e) \in V \smallsetminus t(e)$ be the "head" of the edge. Thus we consider hypergraphs where each edge has exactly one head (more general definitions are common).</li>
<li>We may associate a "symmetric" directed hypergraph $D_G = (V,E')$ of this sort to any hypergraph $G = (V,E)$, by replacing each undirected edge $e \in E$ with a collection of directed variants $E'_e = \{ (e{\,\smallsetminus\,} v, v) \,\vert\, v \in e \}$ and letting $E' = \bigcup_{e \in E} E'_e$.</li>
<li><p>A directed cycle in a directed hypergraph $D = (V,E)$ is just a vertex sequence $(v_0,v_1,\ldots,v_\ell)$ for which $v_{i+1} \ne v_i$ for $0 \leqslant i &lt; \ell$, $v_0 = v_\ell$, and for which for each $0 \leqslant i &lt; \ell$ there is an edge $e_\ell$ for which $v_i \in t(e_i)$ and $v_{i+1} = h(e_i)$.</p></li>
<li><p>A hyperforest is a directed hypergraph in which all vertices have in-degree either zero or one, and which has no cycles in the above sense. (N.B.&nbsp;I&nbsp;am diverging here from the terminology in my reference above, which does not explicitly consider whether the hypergraph is connected; but this cannot be taken for granted in my setting.) The set of nodes of in-degree zero we call the "root set" of the hyperforest. </p></li>
<li><p>A spanning hyperforest $T$ for a directed hypergraph $D = (V,E)$, is simply a subgraph $T \subseteq D$ of the hypergraph which contains all of the vertices $V$ and which is a hyperfohrest. </p></li>
</ul>

<np-hardness><np-complete><hypergraphs><spanning-tree>
Minimising the root-set of a spanning hyperforest of a hypergraph
Niel de Beaudrap
# Minimising the root-set of a spanning hyperforest of a hypergraph

(Asked by: username_0 on 2018-01-23)

I am interested in the complexity of a problem involving spanning hyperforests (a union of hypertrees, which covers all of the vertices) of a $k$-hypergraph. I describe the relevant definitions for hypergraphs below, but the following is the problem on

> **SPANNING HYPERFOREST ROOT SET.** For a directed hypergraph $D$ and an integer $k \geqslant 1$, determine whether there exists a spanning hyperforest for $D$ which has a root-set of size at most $k$.

**Remarks.**

* It is not difficult to show that SPANNING HYPERFOREST ROOT SET is in **NP**: in particular, if a root-set of the suitable size is provided, then a spanning hyperforest with that root-set can be found in polynomial time.
* It is also trivial to find a value of $k$ for which $(D,k)$ is a YES instance: for instance $k = \lvert V(D) \rvert$ (in which case the empty hypergraph is a spanning hyperforest with root set $k$).
* Considered as an optimisation problem, it is usually easy to find values $k < \lvert V(D) \rvert$ for which $(D,k)$ remain YES instances, though it is not clear how easily one can find the optimum.

## Question.

Is SPANNING HYPERFOREST ROOT SET also **NP**-hard? Is this true in the special case where the input hypergraph is "symmetric", in the sense that for any edge $e = (t(e), h(e))$ and for any $v \in s(e) := t(e) \cup h(e)$, there is also an edge $e' = (s(e) {\,\smallsetminus\,} \{v\}, v)$?

---

**Relevant definitions.**

In the following, I am broadly following the definitions of "[Flows on hypergraphs](https://link.springer.com/article/10.1007/BF02614371)" [[free PDF link](https://pdfs.semanticscholar.org/13cf/dff5b9389d3ca511caf9358fd2b3f13c0c11.pdf)] by Cambini, Gallo, and Scutellà.

* A hypergraph is a pair $G = (V,E)$, where $E \subseteq \mathcal P(V)$. If each $e\in E$ has the same cardinality $k$, we call $G$ a $k$-uniform hypergraph (or $k$-hypergraph).
* A directed hypergraph is a pair $D = (V,E)$, where in our setting we let $E \subseteq \mathcal P(V) \times V$ be the set of hyper-edges. For each edge $e \in E$, we let $t(e) = \pi\_1(e) \subseteq V$ be the "tail" of the edge, and $h(e) = \pi\_2(e) \in V \smallsetminus t(e)$ be the "head" of the edge. Thus we consider hypergraphs where each edge has exactly one head (more general definitions are common).
* We may associate a "symmetric" directed hypergraph $D\_G = (V,E')$ of this sort to any hypergraph $G = (V,E)$, by replacing each undirected edge $e \in E$ with a collection of directed variants $E'\_e = \{ (e{\,\smallsetminus\,} v, v) \,\vert\, v \in e \}$ and letting $E' = \bigcup\_{e \in E} E'\_e$.
* A directed cycle in a directed hypergraph $D = (V,E)$ is just a vertex sequence $(v\_0,v\_1,\ldots,v\_\ell)$ for which $v\_{i+1} \ne v\_i$ for $0 \leqslant i < \ell$, $v\_0 = v\_\ell$, and for which for each $0 \leqslant i < \ell$ there is an edge $e\_\ell$ for which $v\_i \in t(e\_i)$ and $v\_{i+1} = h(e\_i)$.
* A hyperforest is a directed hypergraph in which all vertices have in-degree either zero or one, and which has no cycles in the above sense. (N.B. I am diverging here from the terminology in my reference above, which does not explicitly consider whether the hypergraph is connected; but this cannot be taken for granted in my setting.) The set of nodes of in-degree zero we call the "root set" of the hyperforest.
* A spanning hyperforest $T$ for a directed hypergraph $D = (V,E)$, is simply a subgraph $T \subseteq D$ of the hypergraph which contains all of the vertices $V$ and which is a hyperfohrest.

**Tags:** np-hardness, np-complete, hypergraphs, spanning-tree

---

## 2 answers

### Answer by username_1 on 2018-02-11. Score: 1

This answer addresses the NP-hardness of the SPANNING SYMMETRIC HYPERFOREST ROOT SET (SSHRS) problem (given an undirected hypergraph $G$ and a number $k$, is there a spanning hyperforest with root set of size at most $k$ in the symmetric directed hypergraph $D\_G$).

We prove that this problem is hard by reduction from the MAXIMUM UNIQUELY RESTRICTED BIPARTITE MATCHING (MURBM) problem (see <https://link.springer.com/article/10.1007/s00453-001-0004-z> for hardness). A uniquely restricted matching in a graph $B$ is a matching $M$ such that the induced subgraph of $B$ over the vertices of $M$ has exactly one perfect matching ($M$ itself). The MURBM problem asks for a given bipartite graph $B$ and a given number $n$ whether there exist a uniquely restricted matching in the graph with at least $n$ edges.

Note that a matching is uniquely restricted if and only if there exists no cycle in the graph whose edges alternate between being in the matching and not being in the matching. (This is easy to show, so the proof will not be included here).

The reduction from MURBM to SSHRS is simple: we are given a MURBM instance consisting of bipartite graph $B$ and number $n$. Suppose $B$ has vertex parts $V\_1$ and $V\_2$. Define $N(v)$ to be the set of neighbors of $v$ in $B$. Then define a hypergraph $G = (V, E)$ with vertices $V = V\_1$ and edges $E = \{N(v)~|~v\in V\_2\}$. Next, define $k = |V\_1| - n$. In other words, construct the hypergraph $G$ whose bipartite graph model is $B$. Output $G$ and $k$ as the SSHRS instance output of the reduction.

The logic behind the reduction is this:

Choosing a spanning hyperforest in $D\_G$ is equivalent to choosing a set of edges in $D\_G$ subject to certain constraints. But choosing a set of edges in $D\_G$ (subject to certain constraints) is equivalent to choosing a set of edges in $G$ and choosing a vertex to be the head from each (subject to certain constraints). Since a hyperforest allows no cycles, the same edge of $G$ directed in different ways cannot be used (as two such "duplicate" edges form a cycle). Since in a hyperforest the vertices have max in-degree one, the same vertex cannot be chosen as the head of multiple different edges. In other words, the choice of edges in $G$ and heads of those edges that comprises a choice of spannning hyperforest is equivalent to the choice of a matching in the bipartite graph model of $G$ (subject to certain constraints). But by construction, the bipartite graph model of $G$ is exactly the bipartite graph $B$, so choosing a spanning hyperforest in $D\_G$ is equivalent to choosing a matching in $B$ subject to certain constraints.

What are those constraints? Well a hyperforest cannot have any cycles, and must have vertex in-degrees of at most 1. The vertex in-degree constraint is already met by any matching, so the only constraint is to have no cycles. But a cycle in the hyperforest corresponds to a cycle in the bipartite graph model of $G$ such that every second edge is in the corresponding "matching". Thus, the cycle-free condition of the hyperforest is equivalent to the condition that there exists no cycle in the graph whose edges alternate between being in the matching and not being in the matching.

Thus, hyperforests in $G$ correspond to uniquely restricted matchings in $B$. All that's left is to show that the parameters also match: that having a hyperforest with root set size at least $k$ corresponds to having a matching of size at least $n$. Every vertex in a spanning hyperforest has in-degree either 0 or 1, so the number of in-degree-1 vertices is equal to the total in-degree in the spanning hyperforest. But the total in-degree is also equal to the number of edges since each edge has exactly one head. Thus, the number of in-degree-1 vertices in the spanning hyperforest is equal to the number of edges. We also know that the size of the matching equals the number of edges in the hyperforest. Thus the size of the matching equals the number of in-degree-1 vertices in the hyperforest. Furthermore, the number of roots is by definition the number of in-degree-0 vertices. Thus, the size of the root set plus the size of the matching is equal to the number of vertices $|V| = |V\_1|$. Therefore, the hyperforest has root set size at most $k = |V\_1| - n$ if and only if the matching has size at least $n$.


---

### Answer by username_1 on 2018-01-24. Score: 0

# This answer is wrong (question has changed)

This answer shows that the Spanning Hypertree Root Set problem is NP-hard, whereas the question now asks about the Spanning Hyperforest Root Set problem.

## Answer

The $n$-uniform Hypergraph Spanning Tree Problem, which asks for a given undirected $n$-uniform hypergraph whether there exists a spanning hypertree, is NP-hard for any $n \ge 4$ (see *The Steiner tree problem: a tour through graphs,
algorithms, and complexity* by Hans Jürgen Prömel and Angelika Steger).

An undirected hypergraph has a spanning hypertree if and only if the corresponding symmetric directed hypergraph has a spanning hypertree. Furthermore, any spanning hypertree has a number of roots that is at most the number of vertices. Thus, there is an easy reduction from the $n$-uniform Hypergraph Spanning Tree Problem to the $n$-uniform Spanning Hhypertree Root Set problem: given an undirected hypergraph, set $D$ to be the corresponding symmetric directed hypergraph and set $k$ to be the number of vertices in the hypergraph.

Thus, your problem is NP-hard, even if the hypergraph is restricted to be be $n$-uniform for some $n \ge 4$.

> **Comments:**
> **username_1**: You're right. I didn't read your definitions carefully enough and thought that the root is the head of an edge rather than the tail. I'll edit my answer so that it still works.  
> **username_0**: The $k=1$ case of my problem is easy to solve: simply iterate through all vertices, and see if they form the root of a spanning tree/forest in my sense. (Simply see if there are any edges whose tail is just that singleton, and forward-chain if so.) So I think that you must be thinking of another problem, different even than the previous version of my problem if you were to add the condition of connectedness.  
> **username_1**: Looks like when I edited this, I somehow ended up reverting my previous edit. Fixing now.  

---

