Skip to content

Commit

Permalink
simplify dimembers
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlandry committed Jun 14, 2024
1 parent fdd447e commit 2b1ea44
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions xgi/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,25 +984,16 @@ def dimembers(self, e=None, dtype=list):
"""
if e is None:
if dtype is dict:
return {
key: (
self._id_dict[key]["in"].copy(),
self._id_dict[key]["out"].copy(),
)
for key in self
}
return {key: self._id_dict[key].copy() for key in self}
elif dtype is list:
return [
(self._id_dict[key]["in"].copy(), self._id_dict[key]["out"].copy())
for key in self
]
return [self._id_dict[key].copy() for key in self]
else:
raise XGIError(f"Unrecognized dtype {dtype}")

if e not in self:
raise IDNotFound(f'ID "{e}" not in this view')

return (self._id_dict[e]["in"].copy(), self._id_dict[e]["out"].copy())
return self._id_dict[e].copy()

def members(self, e=None, dtype=list):
"""Get the edges of a directed hypergraph.
Expand Down

0 comments on commit 2b1ea44

Please sign in to comment.