Skip to content

Commit d329dc8

Browse files
committed
Fix bug.
1 parent 56cfd60 commit d329dc8

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/elimination_algorithms.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,8 +2302,8 @@ function dissectsimple(weights::AbstractVector{W}, graph::BipartiteGraph{V, E},
23022302
n = nv(graph); m = ne(graph); nn = n + one(V)
23032303

23042304
swork = Scalar{V}(undef)
2305-
vwork1 = Vector{V}(undef, half(m))
2306-
vwork2 = Vector{V}(undef, half(m))
2305+
vwork1 = Vector{V}(undef, m)
2306+
vwork2 = Vector{V}(undef, m)
23072307
vwork3 = Vector{V}(undef, n)
23082308
vwork4 = Vector{V}(undef, n)
23092309
vwork5 = Vector{V}(undef, n)
@@ -2338,6 +2338,11 @@ function dissectsimple(weights::AbstractVector{W}, graph::BipartiteGraph{V, E},
23382338
n = nv(graph); m = ne(graph); nn = n + one(V)
23392339
k = convert(V, length(clique))
23402340

2341+
if m > length(vwork1)
2342+
resize!(vwork1, m)
2343+
resize!(vwork2, m)
2344+
end
2345+
23412346
if !isnegative(level) # unprocessed
23422347
if width <= alg.limit || level >= alg.level # leaf
23432348
push!(nodes, (graph, weights, label, clique, clique, width, -1))
@@ -2435,7 +2440,7 @@ function dissectsimple(weights::AbstractVector{W}, graph::BipartiteGraph{V, E},
24352440
swork = Scalar{V}(undef)
24362441
iwork = Vector{Int}(undef, n)
24372442
vwork1 = Vector{V}(undef, m)
2438-
vwork2 = Vector{V}(undef, half(m))
2443+
vwork2 = Vector{V}(undef, m)
24392444
vwork3 = Vector{V}(undef, n)
24402445
vwork4 = Vector{V}(undef, n)
24412446
vwork5 = Vector{V}(undef, n)
@@ -2473,6 +2478,11 @@ function dissectsimple(weights::AbstractVector{W}, graph::BipartiteGraph{V, E},
24732478
n = nv(graph); m = ne(graph); nn = n + one(V)
24742479
k = convert(V, length(clique))
24752480

2481+
if m > length(vwork1)
2482+
resize!(vwork1, m)
2483+
resize!(vwork2, m)
2484+
end
2485+
24762486
if !isnegative(level) # unprocessed
24772487
if width <= alg.limit || level >= alg.level # leaf
24782488
push!(nodes, (graph, weights, label, clique, clique, width, -1))

0 commit comments

Comments
 (0)