[mod] compute number of nodes during graph construction