Skip to content

Commit 8df35c9

Browse files
committed
Fix classical strength of connection bug
1 parent 3d130ad commit 8df35c9

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/splitting.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ function RS_CF_splitting(S::SparseMatrixCSC)
5454
splitting[i] = F_NODE
5555
end
5656
end
57+
@show lambda
58+
@show interval_ptr
59+
@show interval_count
60+
@show node_to_index
61+
@show index_to_node
5762

5863
for top_index = n_nodes:-1:1
5964
i = index_to_node[top_index]
@@ -71,11 +76,17 @@ function RS_CF_splitting(S::SparseMatrixCSC)
7176

7277
for k in nzrange(S, row)
7378
rowk = S.rowval[k]
79+
@show rowk
80+
if rowk == 83
81+
@show S[:, row]
82+
@show T[:, row]
83+
end
7484
if splitting[rowk] == U_NODE
7585
lambda[rowk] >= n_nodes - 1 && continue
7686
lambda_k = lambda[rowk] + 1
7787
old_pos = node_to_index[rowk]
7888
new_pos = interval_ptr[lambda_k] + interval_count[lambda_k]# - 1
89+
@show new_pos
7990

8091
node_to_index[index_to_node[old_pos]] = new_pos
8192
node_to_index[index_to_node[new_pos]] = old_pos

src/strength.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ function strength_of_connection{T}(c::Classical{T}, A::SparseMatrixCSC)
2121
row = A.rowval[j]
2222
val = A.nzval[j]
2323
if abs(val) >= threshold
24+
if row != i
25+
push!(I, row)
26+
push!(J, i)
27+
push!(V, abs(val))
28+
end
29+
end
30+
31+
if row == i
2432
push!(I, row)
2533
push!(J, i)
26-
push!(V, abs(val))
34+
push!(V, val)
2735
end
2836
end
2937
end

0 commit comments

Comments
 (0)