set parents to nodes