If it is a whole branch of the tree, you wan to remove, just remove a parent element from the UI. All child elements will be removed with it.
If it's more complex, you can use SQL to store the GroupID of the cost centers to a temp table #GroupEx and then run a stored procedure to have them removed:
We needed to remove quite a lot of cost centers, because we've seen some duplications and it messed up a lot of other objects related to cost centers. Purchase Orders with same description randomly changed numbers, restricted operator were unable to login.
In the end we decided to take similar approach to what Markward recommended, but ensured first nothing is linked to the soon-to-be-removed cost centers.