Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize layer assignment problem #16

Merged
merged 19 commits into from
Feb 7, 2022
Merged
Prev Previous commit
Next Next commit
Update layering.jl
  • Loading branch information
davide-f authored Apr 21, 2021
commit f1f3da6a9ed34b786c369afb8e0719f4c9d7d3af
16 changes: 9 additions & 7 deletions src/layering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ function agree_with_opt_layer_assign!(layer_groups, graph, opt_layer_assign)
for (k, l) in zip(key_opt, values_opt)
#current layer of node
curr_layer = findfirst(k .∈ layer_groups)
if curr_layer >= l
@warn "Ignored opt_layer_assign for node $k; dists[k] ($(dists[k])) > l ($l)"
elseif any(has_edge(graph, k, v) for v in vcat(layer_groups[curr_layer:l]...))
error("opt_layer_assign node $k incompatible with edge order")
else
filter!(x->x != k, layer_groups[curr_layer])
push!(layer_groups[l], k)
if !isnothing(curr_layer)
if curr_layer >= l
@warn "Ignored opt_layer_assign for node $k; dists[k] ($(dists[k])) > l ($l)"
elseif any(has_edge(graph, k, v) for v in vcat(layer_groups[curr_layer:l]...))
error("opt_layer_assign node $k incompatible with edge order")
else
filter!(x->x != k, layer_groups[curr_layer])
push!(layer_groups[l], k)
end
end
end
end
Expand Down