I have a shapefile with polygons and need to group them with the same Group_ID if they touch each others. The thing is, once I start assigning a number to one polygon, it needs to keep looking for neighbors of neighbors until all are assigned the same ID in the attributes table. For example:
The grouping should be like:
Polygon_ID Group_ID 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 2 9 2 10 3
I am using QGIS for this, trying a script with python with a recursive function that keeps checking for neighbors until no more are found, no luck so far.