-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
Merge from original
Proposal to account for changes in the labels ordering
Codecov Report
@@ Coverage Diff @@
## main #16 +/- ##
==========================================
- Coverage 92.72% 92.09% -0.64%
==========================================
Files 4 4
Lines 165 177 +12
==========================================
+ Hits 153 163 +10
- Misses 12 14 +2
Continue to review full report at Codecov.
|
Minor changes to avoid unwanted warnings
Changing error(...) in @warn (error may be annoying)
Check vector length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry again for the delay in reviewing.
This seems really complex.
I think it might be simpler if rather than post-processing the layer_groups
this was implemented via modifying the dists
before the layer_groups
are constructed.
# basic form that just always does what the user asked for
force_layers!(dists, forced_layers::Dict{Int, Int})
for (node_id, target_layer) in forced_layers
dists[node_id] = target_layer
end
return dists
end
Which we can fancy up to add the other features.
For example:
force_layers!(graphdists, forced_layers::Dict{Int, Int})
# must process from end to beginning as otherwise can't move things after to make space
ordered_forced_layers = sort(collect(forced_layers), by=last; rev=true)
for (node_id, target_layer) in ordered_forced_layers
curr_layer = dists[node_id]
if target_layer < curr_layer
@warn "Ignored opt_layer_assign for node $node_id; curr layer ($curr_layer) > desired layer ($target_layer)"
elseif any(dists[child] <= target_layer for child in outneighbors(graph, node_id))
@warn "Ignored opt_layer_assign for node $node_id; as placing it at $target_layer would place it on same layer, or later than it's children."
else
dists[node_id] = target_layer
end
end
return dists
end
@oxinabox Sorry for my long delay; I added the test case for the additional feature. |
Not sure why codecov fails, however the CI works perfectly |
The coverage seems to decrease because there are @Warns that are not tested (clearly...), I think that the code should be fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks
I will merge after CI finishes
I think I was summoned here by mistake ^^ |
This commit enables to slightly change the layer assignment problem highlighted in #16 ; yet, for simplicity, nodes cannot be moved beyond layers containing their children nodes.
This change enables the creation of this map:
The original plot had nodes 6 at layer 3 and node 8 at layer 4, instead.