Counting dominating sets and related structures in graphs