The evolutionary advantage of cultural memory on heterogeneous contact networks.