Skip to content

Commit

Permalink
HashEL() insertion now checks if the edge is already present in the l…
Browse files Browse the repository at this point in the history
…ist/hashtable.
  • Loading branch information
krivit committed Feb 5, 2024
1 parent 50784d3 commit 8cbf17e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
6 changes: 5 additions & 1 deletion inst/include/ergm_hash_edgelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8cbf17e

Please sign in to comment.