An Algorithm for the Inverse Distance-2 Dominating Set of a Graph