Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
MatrixEquations = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
MixedSubdivisions = "291d046c-3347-11e9-1e74-c3d251d406c6"
MosekTools = "1ec41992-ff65-5c91-ac43-2df89e9693a4"
MultivariateBases = "be282fd4-ad43-11e9-1d11-8bd9d7e43378"
MultivariateMoments = "f4abf1af-0426-5881-a0da-e2f168889b5e"
MultivariatePolynomials = "102ac46a-7ee4-5c85-9060-abc95bfdeaa3"
Expand Down
13 changes: 9 additions & 4 deletions src/Certificate/Sparsity/ChordalExtensionGraph.jl

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another occurrence of IntDisjointSets on this branch here that should be renamed to IntDisjointSet.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was a merge error. On my branch, I did that change.

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module ChordalExtensionGraph

using DataStructures
import DataStructures
if isdefined(DataStructures, :IntDisjointSet)
const IntDisjointSet = DataStructures.IntDisjointSet # changed in DataStructures v0.19.0
else
const IntDisjointSet = DataStructures.IntDisjointSets
end

export AbstractCompletion, ChordalCompletion, ClusterCompletion
export LabelledGraph, add_node!, add_edge!, add_clique!, chordal_extension
Expand Down Expand Up @@ -343,17 +348,17 @@ Return a cluster completion of `G` and the corresponding maximal cliques.
"""
function completion(G::Graph, ::ClusterCompletion)
H = copy(G)
union_find = IntDisjointSets(num_nodes(G))
union_find = IntDisjointSet(num_nodes(G))
for from in 1:num_nodes(G)
for to in neighbors(G, from)
union!(union_find, from, to)
end
end
cliques = [Int[] for i in 1:num_groups(union_find)]
cliques = [Int[] for i in 1:DataStructures.num_groups(union_find)]
ids = zeros(Int, num_nodes(G))
k = 0
for node in 1:num_nodes(G)
root = find_root!(union_find, node)
root = DataStructures.find_root!(union_find, node)
if iszero(ids[root])
k += 1
ids[root] = k
Expand Down
13 changes: 7 additions & 6 deletions src/Certificate/Symmetry/block_diag.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import DataStructures
if isdefined(DataStructures, :IntDisjointSet)
const IntDisjointSet = DataStructures.IntDisjointSet # changed in DataStructures v0.19.0
else
const IntDisjointSet = DataStructures.IntDisjointSets
end

_isapproxless(a::Real, b::Real) = a < b
function _isapproxless(a::Complex, b::Complex)
Expand Down Expand Up @@ -253,7 +258,7 @@ function block_diag(As, d)
iZ = Z'
@assert iZ ≈ inv(Z)
n = LinearAlgebra.checksquare(A)
union_find = DataStructures.IntDisjointSets(n)
union_find = IntDisjointSet(n)
Bs = [iZ * A * Z for A in As]
for B in Bs
merge_sparsity!(union_find, B)
Expand Down Expand Up @@ -287,11 +292,7 @@ function block_diag(As, d)
end
end

function merge_sparsity!(
union_find::DataStructures.IntDisjointSets,
A,
tol = 1e-8,
)
function merge_sparsity!(union_find::IntDisjointSet, A, tol = 1e-8)
for I in CartesianIndices(A)
i, j = I.I
if abs(A[I]) > tol
Expand Down
Loading