path_to_root function

Extract a path from node to root.