diff --git a/DESCRIPTION b/DESCRIPTION index c57fb6a75..46388ed6c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: ergm -Version: 4.6-7339 +Version: 4.6-7340 Date: 2024-02-05 Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks Authors@R: c( diff --git a/inst/include/ergm_hash_edgelist.h b/inst/include/ergm_hash_edgelist.h index d882081d1..e11f3b18a 100644 --- a/inst/include/ergm_hash_edgelist.h +++ b/inst/include/ergm_hash_edgelist.h @@ -60,8 +60,12 @@ static inline void HashELGetRand(Vertex *tail, Vertex *head, HashEL *hash) { } static inline void HashELInsert(Vertex tail, Vertex head, HashEL *hash) { + kh_put_code r; + khiter_t pos = kh_put(DyadMapUInt, hash->hash, TH(tail, head), &r); + if(r == kh_put_present) return; // Already in the list. + UnsrtELInsert(tail, head, hash->list); - kh_set(DyadMapUInt, hash->hash, TH(tail, head), hash->list->nedges); + kh_val(hash->hash, pos) = hash->list->nedges; } static inline void HashELDelete(Vertex tail, Vertex head, HashEL *hash) {