Recursive search for selected vertices
Some code from this answer. But adapted for bmesh and the selection aspects of this question.

The principle is to start from selected vertices, and:


Make a dictionary of possible links to other vertices
Iterate available vertices and for each follow all possible remaining paths


The code with comments:

import bpy
import bmesh

def make_vert_paths( verts ):
    #Init a set for each vertex
    result = {v : set() for v in verts}
    #Loop over vertices to store connected other vertices
    for v in verts:
        for e in v.link_edges:
            other = e.other_vert( v )
            if other.select:
                result[v].add(other)
    return result

def make_island( starting_vert, paths ):
    #Initialize the island
    island = [starting_vert]
    #Initialize the current vertices to explore
    current = [starting_vert]

    follow = True
    while follow:
        #Get connected vertices that are still in the paths
        eligible = set( [v for v in current if v in paths] )
        if len( eligible ) == 0:
            follow = False #Stops if no more
        else:
            #Get the corresponding links
            next = [paths[i] for i in eligible]
            #Remove the previous from the paths
            for key in eligible:
                island.append( key ) 
                paths.pop( key )
            #Get the new links as new inputs
            current = set( [vert for sub in next for vert in sub] )

    return island

def make_islands( bm_verts ):
    paths = make_vert_paths( bm_verts )
    result = []
    found = True
    while found:
        try:
            #Get one input as long there is one
            vert = next( iter( paths.keys() ) )
            #Deplete the paths dictionary following this starting vertex
            result.append( make_island( vert, paths ) )               
        except:
            found = False
    return result


obj = bpy.context.object

bm = bmesh.new()
bm.from_mesh(obj.data)
bm.verts.ensure_lookup_table()

bm_verts = [v for v in bm.verts if v.select]

islands = make_islands( bm_verts )

print( len(islands) )
#print( islands )