Digraphs icon indicating copy to clipboard operation
Digraphs copied to clipboard

Make behaviour of `DigraphRemoveEdge{s}` consistent when removing no edges

Open Peter-Ing opened this issue 5 years ago • 6 comments

Added an additional method to preserve properties in the case of empty removals.

This addresses issue #260. (Note from Wilf: currently only partially.)

Peter-Ing avatar Nov 11 '20 15:11 Peter-Ing

Oh wait, what is the relationship between this PR and #338?

wilfwilson avatar Nov 14 '20 18:11 wilfwilson

Oh wait, what is the relationship between this PR and #338?

this request should have been an update to #338 but as it hasn't updated it and comments have been left here I have closed #338.

Peter-Ing avatar Nov 16 '20 20:11 Peter-Ing

@Peter-Ing I agree with @wilfwilson. I think the intended changes would be the following:

if digraph is immutable:

  • DigraphRemoveEdges(digraph, [ ]) returns digraph
  • DigraphRemoveEdge(digraph, [ ]) gives the current error (the argument is not valid)
  • DigraphRemoveEdges(digraph, [[src, ran]]) returns an immutable copy of digraph only when [src, ran] is valid. If [src, ran] is not valid, then the function could either give an error, or just return digraph (i.e. not a copy)
  • DigraphRemoveEdge(digraph, [src, ran]) returns an immutable copy of digraph only when [src, ran] is valid. If [src, ran] is not valid, then the function could either give an error, or just return digraph (i.e. not a copy)

I'm not sure which is preferable: giving an error or just returning digraph and doing nothing. The latter would be more consistent with the current behaviour, but the former would probably be more helpful. Any thoughts?

james-d-mitchell avatar Nov 18 '20 09:11 james-d-mitchell

I tend to prefer the former kind of behaviour, I think it is what most people (or at least I) would expect. The latter kind of behaviour seems like it's done for optimisation, letting you reduce code (not having a separate existence check first, in some cases) and save time (by not twice checking whether an edge exists ). Unless users ask for that kind of behaviour, I don't think we should proactively offer it.

wilfwilson avatar Nov 18 '20 09:11 wilfwilson

Codecov Report

Merging #340 (3b09b45) into master (514f5c3) will decrease coverage by 1.67%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #340      +/-   ##
==========================================
- Coverage   96.98%   95.31%   -1.68%     
==========================================
  Files          45       50       +5     
  Lines       12635    13038     +403     
==========================================
+ Hits        12254    12427     +173     
- Misses        381      611     +230     
Impacted Files Coverage Δ
gap/oper.gi 98.37% <100.00%> (+<0.01%) :arrow_up:
src/bitarray.c 93.33% <0.00%> (-1.91%) :arrow_down:
gap/attr.gi 99.31% <0.00%> (-0.69%) :arrow_down:
src/planar.c 93.75% <0.00%> (-0.37%) :arrow_down:
src/perms.c 77.77% <0.00%> (-0.35%) :arrow_down:
src/homos-graphs.c 98.66% <0.00%> (-0.27%) :arrow_down:
src/homos.c 99.08% <0.00%> (-0.07%) :arrow_down:
src/cliques.c 99.26% <0.00%> (-0.04%) :arrow_down:
gap/attr.gd 100.00% <0.00%> (ø)
src/perms.h 100.00% <0.00%> (ø)
... and 11 more

codecov[bot] avatar Jan 27 '21 17:01 codecov[bot]

Stale pull request message

github-actions[bot] avatar Jan 07 '22 01:01 github-actions[bot]