| for t = 1 to Number of erosion recursion |
| Erosion(GMST) |
| Push eroded vertices and edges {ei, vi} into a stack |
| end |
| Begin dilation operation |
| Mark all end vertices if their degrees are one |
| if the stack is not empty |
| Pop a vertex and edge {ei, vi} from the stack |
| if the vertex and edge extends from an end vertex of current graph |
| Add the vertex and edge back to the graph |
| Mark new end vertex |
| else |
| Discard the vertex and edge |
| end |
| end |
| Obtain the backbone graph, Gbb |