Skip to content

Commit 1b279aa

Browse files
author
CindeeM
committed
RF: changed internal_links to degree_within_community for clarity
1 parent 3943ba8 commit 1b279aa

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

brainx/tests/test_weighted_modularity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def test_degree_by_community(self):
120120
part_2comm = wm.WeightedPartition(self.graph, self.communities)
121121
self.assertEqual(part_2comm == degw, False)
122122

123-
def test_internal_links(self):
123+
def test_degree_within_community(self):
124124
part = wm.WeightedPartition(self.graph) # one comm per node
125-
weights = part.internal_links()
125+
weights = part.degree_within_community()
126126
## this inlcudes self links so
127127
self.assertEqual(weights[0], 1.0)
128128

brainx/weighted_modularity.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ def degree_by_community(self):
131131
weights[node_comm] += weight
132132
return weights
133133

134-
def internal_links(self):
135-
""" sum of weighted links strictly inside each community
136-
includes self loops"""
134+
def degree_within_community(self):
135+
""" sum of weighted edges strictly inside each community
136+
including self loops"""
137137
comm = self.communities
138138
weights = [0] * len(comm)
139139
comm = self.communities
@@ -176,7 +176,7 @@ def modularity(self):
176176
raise TypeError('only valid on non directed graphs')
177177

178178
m2 = self.total_edge_weight
179-
internal_connect = np.array(self.internal_links())
179+
internal_connect = np.array(self.degree_within_community())
180180
total = np.array(self.degree_by_community())
181181
return np.sum(internal_connect/m2 - (total/(2*m2))**2)
182182

0 commit comments

Comments
 (0)