Function to find all named nodes in a grasp program