Algorithm for a puzzle game

Hello, I’m working on a circular Bubble Shooter (like Bubble Spinner).

Is this algorithm is a good idea to removed the bubbles that are not attached to the framework ? Or do you advise me another algorithm ?