Skip to content

Commit d45add9

Browse files
committed
fix: account for idx=0
1 parent 6adc35a commit d45add9

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

xgi/core/dihypergraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def add_edge(self, members, idx=None, **attr):
581581
self._edge_attr[uid] = self._edge_attr_dict_factory()
582582
self._edge_attr[uid].update(attr)
583583

584-
if idx: # set self._edge_uid correctly
584+
if idx is not None: # set self._edge_uid correctly
585585
update_uid_counter(self, idx)
586586

587587
def add_edges_from(self, ebunch_to_add, **attr):

xgi/core/hypergraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ def add_edge(self, members, idx=None, **attr):
627627
self._edge_attr[uid] = self._edge_attr_dict_factory()
628628
self._edge_attr[uid].update(attr)
629629

630-
if idx: # set self._edge_uid correctly
630+
if idx is not None: # set self._edge_uid correctly
631631
update_uid_counter(self, idx)
632632

633633
def add_edges_from(self, ebunch_to_add, **attr):

xgi/core/simplicialcomplex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def add_simplex(self, members, idx=None, **attr):
314314
warn(f"uid {idx} already exists, cannot add simplex {members}")
315315
return
316316

317-
idx = next(self._edge_uid) if not idx else idx
317+
idx = next(self._edge_uid) if idx is None else idx
318318

319319
self._add_simplex(members, idx, **attr)
320320

0 commit comments

Comments
 (0)