Hydrogen formation on graphitic surfaces: energetics and dynamics of elementary processes