similarly, an embedding of a rooted planar graph can be encoded as a blossom tree. if the root is in the corner, this can be done in linear time. the edges of a rooted planar graph can be oriented so that there is a path from the root to any vertex, but there are no counter-clockwise cycles. in this case, one can use a depth-first algorithm to turn it into a blossom tree. starting with the root vertex, look at every edge incident to it. if it points away from our current vertex, cut it, labelling the outward half-edge as a closing stem and inward half-edge as an opening stem. if it points toward our current vertex, mark it as to be kept and set its other endpoint as our current vertex. continue until all edges have been considered. if the map is not rooted in a corner, constructing the blossom tree takes quadratic time.