Skip to content

Commit 7a5a48a

Browse files
author
CindeeM
committed
RF: cleaning up doc strings
1 parent ca76b2a commit 7a5a48a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

brainx/modularity.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,25 @@ def __init__(self, graph, index):
5656
Graph to which the partition index refers to.
5757
5858
index : dict
59-
A dict that maps module labels to sets of nodes, this describes the
60-
partition in full.
59+
A dict of sets that maps module/partition labels to sets of
60+
nodes, this describes the partition in full.
6161
6262
Note
6363
----
64-
The values in the index dict MUST be real sets, not lists. No checks
65-
are made of this fact, but later the code relies on them being sets and
66-
may break in strange manners if the values were stored in non-set
67-
objects.
64+
The values in the index dict MUST be real sets, not lists.
6865
"""
6966
# Store references to the original graph and label dict
7067
if not type(index) == type({}):
71-
raise TypeError('index should be of type dict(), not %s'%type(index))
72-
68+
raise TypeError('index should be of type dict(),'\
69+
'not %s'%type(index))
7370
self.index = copy.deepcopy(index)
7471

7572
## add quick check to make sure the passed index is
7673
## a dict of sets
7774
self._check_index_contains_sets()
7875

7976
# We'll need the graph's adjacency matrix often, so store it once
80-
self.graph_adj_matrix = nx.adj_matrix(graph)
77+
self.graph_adj_matrix = np.triu(nx.adj_matrix(graph))
8178
#make sure adj_matrix is binary otherwise raise exception
8279
if not self.graph_adj_matrix.sum() == \
8380
self.graph_adj_matrix.astype(bool).sum():

0 commit comments

Comments
 (0)