Delay analysis of epidemic schemes in sparse and dense heterogeneous contact environments