News for hackers. Stuff that matters.
Re:enclose.horse by emil-lp on Tuesday January 06, 2026 @11:47AM (#46514720)
It's NP-hard from Minimum s–t Cut with at least k Vertices. That's the edge version, but since the grid graph is 4-regular(-ish), the problem is trivially convertible to the vertex version.
Re:enclose.horse by sltkr on Wednesday January 07, 2026 @04:15PM (#46532931)
That conclusion may be too hasty. If min cut with k vertices is NP-hard on arbitrary graphs, that doesn't automatically mean that that applies to a 2D grid too.

Is NP hardness proven for just planar graphs? Those are closer to the 2D grid, but still slightly more general. All I could find was a reduction to densest k subgraphs, but Wikipedia tells me that whether that problem is NP hard for planar graphs is an open question.

To be clear, I would be very surprised if the problem turns out to be _not_ NP hard, but there is no trivial equivalence to min cut in general graphs to show that it is.

Re:enclose.horse by emil-lp on Thursday January 08, 2026 @05:41AM (#46539514)
I agree, that is a good point. Although it is (induced) subgraphs of 2D grids, which gets you a bit closer to the planar case (albeit with bounded degree).

It might be polytime on planar graphs, but that would be surprising.

Re:enclose.horse by sltkr on Wednesday January 07, 2026 @04:23PM (#46533063)
Also I don't think the equivalence between edge/vertex versions is trivial at all (though maybe we just have different standards of triviality).

For example, in a grid like this:

    ..####
    .....#
    #.#..#
    #...H#
    ######
A single wall placed (i.e. vertex removed) can block two edges, and it's not obvious what graph transformation can turn that into a single edge.
Re:enclose.horse by emil-lp on Thursday January 08, 2026 @05:39AM (#46539506)
You transform it into the directed case and then you turn each vertex into an arc.

There is a standard construction for going between vertex and edge cuts.