Keep only edges that create a closed loop

Ah, in my first answer I think I misunderstood your question. If you’re wondering about how to remove the “legs” and keep the loop, I’m not sure how to do that with VTK.