I have a graph G (G=(V,E)), where each edge has a non negative weight to it.
My problem is to find a subset S (it doesn't have to exist) of nodes such the sum of all the weights of the edges that start in S and end in V\S is lower than a given positive k.
My approach was to pick a random node in the graph, run a bfs on a masked version of G where only the edges that are larger than k remain, and then check if each component of the masked G may be such S in G, if none may apply than ill conclude that no such S exists.
I calculated that this algorithm will have a run time of O(E^2 +V)
Now im finding a hard time to prove this algorithm is correct, but at the same time in struggling to find an example where it is incorrect.
Maybe someone could help me prove this algorithm is correct.