Get number of connected components using Connectivity filter

Hi

I’m using the Connectivity filter to get the connected components in a mesh. Is there a way to get the number of connected components using python?

This is the code I have so far:

from paraview.simple import *

headbinaryzlibvti = XMLImageDataReader(FileName=['head-binary-zlib.vti'])
headbinaryzlibvti.PointArrayStatus = ['Scalars_']
renderView1 = GetActiveViewOrCreate('RenderView')
headbinaryzlibvtiDisplay = Show(headbinaryzlibvti, renderView1)

connectivity1 = Connectivity(Input=headbinaryzlibvti)
connectivity1Display = Show(connectivity1, renderView1)