A method and system for compressing a tree with a plurality of nodes that
each may be associated with a node identifier and a parent node
identifier. The method may comprise for each node in the tree determining
whether the current node is to be deleted, If the current node is to be
deleted updating a list of deleted nodes such that the node identifier of
the current node may be stored; a parameter representing a number of
nodes currently having been deleted from the tree may be stored, such
that the parameter is associated with the node identifier of the current
node, and updating the node identifier and the parent node identifier of
the current node as a function of the list of deleted nodes. Each node in
the tree is visited only once.