Input: TPSTNode root_tpst
Output: TPSTNode root_tpst
for each route node in level-order by visiting root_tpst do
if Children.size == 1 and type == Sequence then
  children = Children;
  parent = Parent;
(5)   parent.child.remove;
(6)   parent.child.add(children);
(7)  end
(8) end
(9) return root_tpst;
Algorithm 4: Check TPST.