Permanently delete nodes?

I am trying this code to delete nodes, but it does not seem to work.
If I put the graph on “View areas” it shows the nodes deleted, but on all other graph visualization modes, the deleted nodes still appear

        DeleteAllRegionsExcept aThis = target as DeleteAllRegionsExcept;
        VisualElement VisualElement = new VisualElement();
        Button Button;
        VisualElement.Add(Button = new Button(() => {
            RecastGraph recastGraph = AstarPath.active.data.recastGraph;
            uint[] areas = aThis.RetainNodes.Cast(T => {
                NNInfoInternal v = recastGraph.GetNearest(T.position);
                return v.node.Area;
            }).ToArray();
            recastGraph.GetNodes((N) => {
                if (Array.IndexOf(areas, N.Area) < 0) {
                    N.Destroy();
                }
                AstarPath.active.QueueGraphUpdates();
            });
        }));
        Button.text = "DO IT";
        VisualElement.Add(new IMGUIContainer(() => DrawDefaultInspector()));
        return VisualElement;

Hi

Deleting nodes like that is not supported. The node.Destroy method is documented as being an internal method and should only be used by the graph class itself. You might be interested in the RelevantGraphSurface component. RelevantGraphSurface - A* Pathfinding Project

Otherwise the only way to remove nodes like that is to replace the whole tile using ReplaceTile

Yeah, the objective was to delete all “unreachable” meshes, as some sort of post process, to remove navmeshes on ceilings and other places where my NPC might end up warping to if they ever fall off the navmesh.
Maybe replacing the tile could do that, but that sounds way harder than I was expecting it would be.