<p>If the weight function is non-negative, then the set of edges not contained in a maximum weight spanning tree is indeed a MWFES. But if the weight function is arbitrary, a MWFES will contain all the non-positive weight edges and then a MWFES can be computed for the remaining edges.</p>

<p>Here the proof of the non-negative case. Let $\mathcal{T}$ be a maximum weight spanning tree in G and $w$ the weight function. It can be shown first that there exists a MWFES without edges from $\mathcal{T}$, and then, to conclude, that a FES without edges from $\mathcal{T}$ must contain all the edges not in $\mathcal{T}$.</p>

<p>The proof of the first statement: First of all a FES always exists (all the edges from G are a FES). Let $\mathcal{F}$ be a MWFES in graph G, and suppose that it contains an edge $e\in\mathcal{T}$. We will show that there exists a FES not containing $e$ and with weight at most the weight of $\mathcal{F}$. Let $\mathcal{C}_e$ denote the set of cycles $C$ in G such that $C \cap \mathcal{F} = \{e\}$ (i.e. cycles containing $e$ and not any other edge from $\mathcal{F}$). Notice that we can assume $|\mathcal{C}_e| = 1$: if it is zero, then $\mathcal{F}\setminus \{e\}$ is a FES with weight at most the weight of $\mathcal{F}$; if it is at least $2$, then let $C_1, C_2 \in \mathcal{C}_e$, $C_1 \neq C_2$. $C_1 \bigtriangleup C_2$ is a cycle (or a family of disjoint cycles) not containing $e$, and by definition of $\mathcal{C}_e$, not containing any edge from $\mathcal{F}$, which is a contradiction because $\mathcal{F}$ is a FES. The cycle in $\mathcal{C}_e$ must contain an edge $e'\notin \mathcal{T}$ such that $w(e') \le w(e)$ (otherwise $\mathcal{T} \cup \{e'\} \setminus \{e\}$ for any $e' \notin \mathcal{T}$ in the cycle would be a spanning tree with strictly larger weight). Then $\mathcal{F} \cup \{e'\} \setminus \{e\}$ is also a FES with weight at most the weight of $\mathcal{F}$, and hence a MWFES. Iterating this argument, we can show that there exists a MWFES without edges from $\mathcal{T}$.</p>

<p>Finally, each fundamental cycle (cycle in $\mathcal{T} \cup \{e\}$ for each $e \notin \mathcal{T}$) must be covered by an edge from the FES, so a FES without edges from $\mathcal{T}$ must contain all the edges $e\notin \mathcal{T}$. This shows that the set of edges not in $\mathcal{T}$ are a MWFES.</p>

<p>I hope it is clear enough. Best regards!</p>

CC BY-SA 3.0
2016-08-29T05:28:48.027Z
What does C1△C2 mean?
TomR
CC BY-SA 3.0
2018-01-04T11:36:17.760Z
Can you explain how to deal with the case |C_e|=0. It could occur that the only cycles that contain e always contain some other edge in F as well.
Maximilian Mordig
CC BY-SA 3.0
2016-07-25T14:22:13.190Z
2016-07-25T14:22:13.190Z
W. Gálvez
<p>It is explained in an easier way at <a href="https://softwareengineering.stackexchange.com/a/291621">https://softwareengineering.stackexchange.com/a/291621</a>. Consider only positive weights, otherwise proceed as explained above. Further, assume only one component, you can otherwise apply it separately to each component.</p>

<p>You first prove that the graph minus the feedback set must be a tree T (if it is a minimum feedback set). Then, giving the sum of all weights W, the total weight of F is (W - sum of weights in T). Hence, this weight is minimal if we construct a tree T of maximum weight. That is, T must be a maximum spanning tree.</p>

CC BY-SA 3.0
2018-01-04T11:32:12.397Z
2018-01-04T11:32:12.397Z
Maximilian Mordig
<p>Let G = (V,E) be an undirected graph. A set F ⊆ E of edges is called a <strong>feedback-edge set if every cycle of G has at least one edge in F</strong>. Suppose that G is a weighted undirected graph with positive edge weights. <strong>Design an efficient algorithm to find a minimum-weight feedback-edge set (MWFES).</strong></p>

<p>There is large discussion about this problem in another question in programmers forum:  <a href="https://stackoverflow.com/questions/10791689/how-to-find-feedback-edge-set-in-undirected-graph">https://stackoverflow.com/questions/10791689/how-to-find-feedback-edge-set-in-undirected-graph</a> The conclusion of that discussion is that MWFSE are those edges that remain in graph after removal of edges that belong to the maximum-weight spanning tree (which is minimum-weight spanning tree on the graph with reversed weights, those spanning trees can be found by Kruskal algorith in polynomial time).</p>

<p>I have found simple counterexample of such strategy, see in pic. This counterexample takes into account the case when one edge can belong to two cycles and it can be more benefitial to chose this common edge instead of choosing two edges with minimum weights. So, in this example MWFES clearly consists from the one edge with weight 7, but minimum spanning tree have edges 7+100+101 and that leaves edges 5 and 6 for the MWFES, but MWFES with those two edges is not minimal one.</p>

<p><strong>So, are there non-NP hard algorithms for finding MWFES?</strong></p>

<p>p.s. One comment in the cited question goes like this "Note that you can easily find minimal (not minimum) solutions". So - what is distinction between minimum and minimal in such problems. Is there such distinction at all?</p>

<p><a href="https://i.sstatic.net/c6qJf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c6qJf.png" alt="enter image description here"></a> </p>

CC BY-SA 3.0
2016-07-21T06:42:01.803Z
Minimum FES is complement of maximum-weight spanning tree, and maximum-weight spanning tree has edges 7, 100, 101. Besides I understood why edge 7 does not belong to FES. This graph has 3 cycles and outer cycle does not contain edge 7, so, 5 or 6 should be in FES.
TomR
<graph-theory><graph-algorithms><np-hardness>
Minimum-weight feedback edge set in undirected graph - how to find it? Is it NP hard problem?
TomR
# Minimum-weight feedback edge set in undirected graph - how to find it? Is it NP hard problem?

(Asked by: username_0 on 2016-07-20)

Let G = (V,E) be an undirected graph. A set F ⊆ E of edges is called a **feedback-edge set if every cycle of G has at least one edge in F**. Suppose that G is a weighted undirected graph with positive edge weights. **Design an efficient algorithm to find a minimum-weight feedback-edge set (MWFES).**

There is large discussion about this problem in another question in programmers forum: <https://stackoverflow.com/questions/10791689/how-to-find-feedback-edge-set-in-undirected-graph> The conclusion of that discussion is that MWFSE are those edges that remain in graph after removal of edges that belong to the maximum-weight spanning tree (which is minimum-weight spanning tree on the graph with reversed weights, those spanning trees can be found by Kruskal algorith in polynomial time).

I have found simple counterexample of such strategy, see in pic. This counterexample takes into account the case when one edge can belong to two cycles and it can be more benefitial to chose this common edge instead of choosing two edges with minimum weights. So, in this example MWFES clearly consists from the one edge with weight 7, but minimum spanning tree have edges 7+100+101 and that leaves edges 5 and 6 for the MWFES, but MWFES with those two edges is not minimal one.

**So, are there non-NP hard algorithms for finding MWFES?**

p.s. One comment in the cited question goes like this "Note that you can easily find minimal (not minimum) solutions". So - what is distinction between minimum and minimal in such problems. Is there such distinction at all?

[![enter image description here](https://i.sstatic.net/c6qJf.png)](https://i.sstatic.net/c6qJf.png)

**Tags:** graph-theory, graph-algorithms, np-hardness
> **Comments:**
> **username_0**: Minimum FES is complement of maximum-weight spanning tree, and maximum-weight spanning tree has edges 7, 100, 101. Besides I understood why edge 7 does not belong to FES. This graph has 3 cycles and outer cycle does not contain edge 7, so, 5 or 6 should be in FES.  

---

## 2 answers

### Answer by username_1 on 2016-07-25. Score: 2 | Accepted answer

If the weight function is non-negative, then the set of edges not contained in a maximum weight spanning tree is indeed a MWFES. But if the weight function is arbitrary, a MWFES will contain all the non-positive weight edges and then a MWFES can be computed for the remaining edges.

Here the proof of the non-negative case. Let $\mathcal{T}$ be a maximum weight spanning tree in G and $w$ the weight function. It can be shown first that there exists a MWFES without edges from $\mathcal{T}$, and then, to conclude, that a FES without edges from $\mathcal{T}$ must contain all the edges not in $\mathcal{T}$.

The proof of the first statement: First of all a FES always exists (all the edges from G are a FES). Let $\mathcal{F}$ be a MWFES in graph G, and suppose that it contains an edge $e\in\mathcal{T}$. We will show that there exists a FES not containing $e$ and with weight at most the weight of $\mathcal{F}$. Let $\mathcal{C}\_e$ denote the set of cycles $C$ in G such that $C \cap \mathcal{F} = \{e\}$ (i.e. cycles containing $e$ and not any other edge from $\mathcal{F}$). Notice that we can assume $|\mathcal{C}\_e| = 1$: if it is zero, then $\mathcal{F}\setminus \{e\}$ is a FES with weight at most the weight of $\mathcal{F}$; if it is at least $2$, then let $C\_1, C\_2 \in \mathcal{C}\_e$, $C\_1 \neq C\_2$. $C\_1 \bigtriangleup C\_2$ is a cycle (or a family of disjoint cycles) not containing $e$, and by definition of $\mathcal{C}\_e$, not containing any edge from $\mathcal{F}$, which is a contradiction because $\mathcal{F}$ is a FES. The cycle in $\mathcal{C}\_e$ must contain an edge $e'\notin \mathcal{T}$ such that $w(e') \le w(e)$ (otherwise $\mathcal{T} \cup \{e'\} \setminus \{e\}$ for any $e' \notin \mathcal{T}$ in the cycle would be a spanning tree with strictly larger weight). Then $\mathcal{F} \cup \{e'\} \setminus \{e\}$ is also a FES with weight at most the weight of $\mathcal{F}$, and hence a MWFES. Iterating this argument, we can show that there exists a MWFES without edges from $\mathcal{T}$.

Finally, each fundamental cycle (cycle in $\mathcal{T} \cup \{e\}$ for each $e \notin \mathcal{T}$) must be covered by an edge from the FES, so a FES without edges from $\mathcal{T}$ must contain all the edges $e\notin \mathcal{T}$. This shows that the set of edges not in $\mathcal{T}$ are a MWFES.

I hope it is clear enough. Best regards!

> **Comments:**
> **username_0**: What does C1△C2 mean?  
> **username_2**: Can you explain how to deal with the case |C_e|=0. It could occur that the only cycles that contain e always contain some other edge in F as well.  

---

### Answer by username_2 on 2018-01-04. Score: 1

It is explained in an easier way at <https://softwareengineering.stackexchange.com/a/291621>. Consider only positive weights, otherwise proceed as explained above. Further, assume only one component, you can otherwise apply it separately to each component.

You first prove that the graph minus the feedback set must be a tree T (if it is a minimum feedback set). Then, giving the sum of all weights W, the total weight of F is (W - sum of weights in T). Hence, this weight is minimal if we construct a tree T of maximum weight. That is, T must be a maximum spanning tree.


---

