Conversation
91c80c5 to
0634eed
Compare
There was a problem hiding this comment.
Thanks for the implementation! I had some suggestions for the documentation and for improving the performance of the methods. Mainly more details in the docs and reworking some loops to implement more efficient DFS.
Some other things:
- The documentation is not currently linked in the manual. You should edit the correct
doc/z-chapX.xmlfile to add this. For example, to get theDigraphDominatingSetdocumentation to show up you should add the<#Include Label="DigraphDominatingSet">tag in the correct place ofdoc/z-chap4.xml. You can test this by seeing if?DigraphDominatingSetshows up the docs after runningDigraphsMakeDoc()ingap. Same applies for the other functions. - Functions need to be more careful about symmetric vs non symmetric digraphs.
- You should re-run the benchmarks after making the performance based changes to the implementation. I think currently the benchmarks are skewed by the time it takes to find the dominating set/spanning tree, but after the reimplementation this time should become negligible, and it will be more about how many vertices need to be checked. So maybe hold-off on removing the methods for now.
Afterwards should be good to merge!
|
@RheyaM, I wonder if you could merge or rebase to resolve the merge conflicts with the current main branch. Then could you indicate whether you think you've resolved @reiniscirpons's comments? We can then review this again. |
…implemented methods
…nges for efficiency
…r symmetric digraphs
18ef784 to
38b4803
Compare
|
Thanks again for the PR @RheyaM ! I took some time to finish off some minor polish so we can merge into main. @mtorpey @james-d-mitchell Could either of you give this a review when you have the time please? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #884 +/- ##
==========================================
+ Coverage 97.45% 97.46% +0.01%
==========================================
Files 50 50
Lines 21189 21301 +112
Branches 639 639
==========================================
+ Hits 20649 20761 +112
Misses 475 475
Partials 65 65 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
james-d-mitchell
left a comment
There was a problem hiding this comment.
Some superficial changes, then I'm happy to merge this
| <M>S</M> and repeatedly adding to <M>S</M> the least vertex that is not | ||
| in <M>S</M> and not and out-neighbour of <M>S</M>. | ||
|
|
||
| See also <Ref Oper="IsDigraphOutDominatingSet"/> for a further |
There was a problem hiding this comment.
| See also <Ref Oper="IsDigraphOutDominatingSet"/> for a further | |
| See also <Ref Oper="IsDigraphOutDominatingSet"/> for further |
| in-dominating set</E> of <A>digraph</A> with respect to the ordering | ||
| <M>1 < 2 < ... < n</M> where <M>n</M> is the number of vertices in | ||
| <A>digraph</A>. This is equivalently the greedy out-dominating set of | ||
| the <Ref Attr="DigraphDual"/> of <A>digraph</A>. |
There was a problem hiding this comment.
| the <Ref Attr="DigraphDual"/> of <A>digraph</A>. | |
| the <Ref Attr="DigraphReverse"/> of <A>digraph</A>. |
The dual is the graph where every non-edge becomes an edge and vice versa, do you mean the reverse?
| ordering <A>order</A>) vertex that is not in <M>S</M> and not and | ||
| out-neighbour of <M>S</M>. | ||
|
|
||
| See also <Ref Oper="IsDigraphOutDominatingSet"/> for a further |
There was a problem hiding this comment.
| See also <Ref Oper="IsDigraphOutDominatingSet"/> for a further | |
| See also <Ref Oper="IsDigraphOutDominatingSet"/> for further |
| in-dominating set</E> of <A>digraph</A> with respect to the ordering | ||
| that the list <A>order</A> induces on the vertices in | ||
| <A>digraph</A>. This is equivalently the greedy out-dominating set of | ||
| the <Ref Attr="DigraphDual"/> of <A>digraph</A>. |
There was a problem hiding this comment.
| the <Ref Attr="DigraphDual"/> of <A>digraph</A>. | |
| the <Ref Attr="DigraphReverse"/> of <A>digraph</A>. |
Same comment as above.
| </ManSection> | ||
| <#/GAPDoc> | ||
|
|
||
|
|
There was a problem hiding this comment.
No change required in this file.
| # vertices such that every vertex in vertices is in S or adjacent | ||
| # to a vertex in S. | ||
| # | ||
| # This is done in a greedy manner by including every vertex in |
There was a problem hiding this comment.
This is probably not important, but can you possibly reflow this comment, the line breaks look weird to me.
| return 0; | ||
| fi; | ||
|
|
||
| EdgeD := UnitEdgeWeightedDigraph(DigraphImmutableCopyIfMutable(digraph)); |
There was a problem hiding this comment.
Move this line down to just before if Length(D) > 1 then no point in doing this here, again a minor point.
| fi; | ||
|
|
||
| return Minimum(min, | ||
| Minimum(Minimum(OutDegrees(EdgeD)), |
There was a problem hiding this comment.
Minimum is associative, no? So this could just be Minimum(min, Minimum(OutDegrees(EdgeD)), Minimum(InDegrees(EdgeD)), right?
| if not Length(vertex_order) = DigraphNrVertices(digraph) or | ||
| not Set(vertex_order) = DigraphVertices(digraph) then |
There was a problem hiding this comment.
| if not Length(vertex_order) = DigraphNrVertices(digraph) or | |
| not Set(vertex_order) = DigraphVertices(digraph) then | |
| if Length(vertex_order) <> DigraphNrVertices(digraph) or | |
| Set(vertex_order) <> DigraphVertices(digraph) then |
| [IsDigraph, IsList], | ||
| function(digraph, vertex_order) | ||
| if not Length(vertex_order) = DigraphNrVertices(digraph) or | ||
| not Set(vertex_order) = DigraphVertices(digraph) then |
Implemented two methods for calculating the EdgeConnectivity of a Digraph, one using Spanning Trees and one using Dominating Sets, based on the Algorithms detailed in: https://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf
Additional functions: DigraphDominatingSet() and DigraphGetNeighbourhood(), for getting a Dominating Set of a digraph and getting the neighbourhood of a subset of vertices in a digraph, respectively.