@@ -38,18 +38,17 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
38
38
index_to_node = zeros (Int,n)
39
39
node_to_index = zeros (Int,n)
40
40
41
- # compute lambdas - number of neighbors
42
41
for i = 1 : n
43
- lambda[i] = Sp[i + 1 ] - Sp[i]
44
- # number of nodes with a certain neighbor count, counting the node itself
42
+ # compute lambda[i] - the number of nodes strongly coupled to node i
43
+ lambda[i] = Sp[i + 1 ] - Sp[i]
45
44
interval_count[lambda[i] + 1 ] += 1
46
45
end
47
46
48
47
# initial interval_ptr
49
48
@views accumulate! (+ , interval_ptr[2 : end ], interval_count[1 : end - 1 ])
50
49
51
- # sort the nodes by their number of neighbours :
52
- # `index_to_node[idx]` is the node with `idx`th least number of neighbours
50
+ # sort the nodes by the number of nodes strongly coupled to them :
51
+ # `index_to_node[idx]` is the node with `idx`th least number of nodes coupled to it
53
52
# `node_to_index[idx]` is the position of the `idx`th node in `index_to_node`
54
53
# linear time and allocation-free equivalent to:
55
54
# sortperm!(index_to_node, lambda)
@@ -64,7 +63,7 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
64
63
end
65
64
splitting = fill (U_NODE, n)
66
65
67
- # all nodes with no neighbors (but themselves) become F nodes
66
+ # all nodes which no other nodes are strongly coupled to become F nodes
68
67
for i = 1 : n
69
68
if lambda[i] == 0
70
69
splitting[i] = F_NODE
@@ -75,7 +74,7 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
75
74
# highest lambda[i].
76
75
77
76
# index_to_node[interval_ptr[i]+1 : interval_ptr[i+1]] includes the set of U nodes with
78
- # i-1 neighbors , and other "inactive" F and C nodes.
77
+ # i-1 nodes strongly coupled to them , and other "inactive" F and C nodes.
79
78
80
79
# C nodes are always in index_to_node[top_index:n]. So at the end of the last
81
80
# non-empty interval_ptr[i]+1 : interval_ptr[i+1] will be all the C nodes together
@@ -99,7 +98,7 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
99
98
if splitting[row] == U_NODE
100
99
splitting[row] = F_NODE
101
100
102
- # increment lambda for all U neighbours of the new F points
101
+ # increment lambda for all U nodes that node `row` is strongly coupled to
103
102
for k in nzrange (T, row)
104
103
rowk = T. rowval[k]
105
104
@@ -129,7 +128,7 @@ function RS_CF_splitting(S::SparseMatrixCSC, T::SparseMatrixCSC)
129
128
end
130
129
end
131
130
132
- # decrement lambda for all U neighbours of the new C point
131
+ # decrement lambda for all U nodes that node i is strongly coupled to
133
132
for j in nzrange (T, i)
134
133
row = T. rowval[j]
135
134
if splitting[row] == U_NODE
0 commit comments