Detect closed polydata line

Hello,

I have a model which has a rim which is detectable with vtkFeatureEdges by using SetFeatureEdges(True) and SetFeatureAngle to a value between 35 and 45.

Decreasing the feature angle incrementally and selecting the largest segment with SurfaceToolbox.extractLargestConnectedComponent leads to a more and more complete recognition of the rim, until the rim is visually closed.

surface:

feature angle 48°:

feature angle 45°:

feature angle 39°:

The resulting polydata consists of cells which are all of type vtkLine with two points.

Q1: What is the most straightforward way of identifying, if the line is closed?

Q2: Is there is a better strategy for extracting the rim?

Thank you

Kambiz

Forgot to mention: my ultimate goal is to cut the mesh in two parts at the position of the rim. So any hints on how to achieve this are also highly appreciated.