Is there an algorithm that takes a directed graph as input, and as output gives the minimum number of edges to "break" in order to prevent loops?
As an example, the loops in the above graph are:
- A, B, C, D
- A, B, E
- E, G, H, F
And the minimum number of edges to break all of them:
-
- A - B, breaks 2 loops
-
- E - G, breaks 1 loop
It gets more complicated when the loops are nested inside each other and share edges.
My current approach is to find all the loops, group by most common edge, order desc, and break them in that order whilst the loops are still unbroken from the previous iterations.
I have tried a few methods and they all vary by the count of edges they break - I'm looking for the minimum theoretically possible.
Is there an established algorithm that does this?
