Skip to content

Commit

Permalink
Use more efficient array slicing when computing weight between vertex…
Browse files Browse the repository at this point in the history
… sets
  • Loading branch information
pmacg committed Jan 11, 2022
1 parent 91043fd commit c120c72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sgtl/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def weight(self,
:return: The weight w(L, R)
"""
self._check_vert_num(vertex_set_l, vertex_set_r)
raw_weight = self.lil_adj_mat[vertex_set_l][:, vertex_set_r].sum()
raw_weight = self.lil_adj_mat[vertex_set_l].transpose()[vertex_set_r].sum()

# If the two sets L and R overlap, we will have double counted any edges inside this overlap, save for the
# self-loops
Expand Down

0 comments on commit c120c72

Please sign in to comment.