Extract a sub-mesh from its boundary

Let’s say I have a list of connected edges in a mesh enclosing a part of it (the sub-mesh).
Let’s say also I have an heuristic giving me a vertex V in the sub-mesh.
Now I’d like to select all the vertices “inside” of the connected edges, i.e. containing the vertex V.

To illustrate the problem a bit, it would be going from that

to that:

A basic way of doing that would be a breadth first search with the vertex V as the root and the connected edges vertices as a list of already known vertices which should not be explored.

Unfortunately the BFS algorithm in VTK does not allow to have a list of already known vertices, which is understandable since the idea above is not the original algorithm.

Is there a way to achieve what I want from the VTK API or do I have to do it myself ?
My main concern if I have to do it myself is a performance problem since I’d have to do it in Python.

Thanks for your help!

vtkSelectPolyData can do this. Use SetLoop method to define the edges.

Thanks Andras, I knew there must be something like that.

This example SelectPolyData part of the VTKExamples Project may help.

Enjoy VTK,