Skip to content

Implementing DigraphEdgeConnectivity - #884

Open
RheyaM wants to merge 24 commits into
digraphs:mainfrom
RheyaM:EdgeConnectivity
Open

RheyaM wants to merge 24 commits into
digraphs:mainfrom
RheyaM:EdgeConnectivity

Conversation

@RheyaM

@RheyaM RheyaM commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

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.

@reiniscirpons reiniscirpons left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.xml file to add this. For example, to get the DigraphDominatingSet documentation to show up you should add the <#Include Label="DigraphDominatingSet"> tag in the correct place of doc/z-chap4.xml. You can test this by seeing if ?DigraphDominatingSet shows up the docs after running DigraphsMakeDoc() in gap. 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!

Comment thread doc/oper.xml Outdated
Comment thread doc/oper.xml Outdated
Comment thread doc/weights.xml Outdated
Comment thread doc/weights.xml Outdated
Comment thread gap/oper.gi Outdated
Comment thread gap/weights.gi Outdated
Comment thread gap/weights.gi Outdated
Comment thread gap/weights.gi Outdated
Comment thread gap/weights.gi Outdated
Comment thread gap/weights.gi Outdated
@mtorpey

mtorpey commented Apr 23, 2026 •

Copy link
Copy Markdown
Collaborator

@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.

@reiniscirpons

Copy link
Copy Markdown
Collaborator

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

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.46%. Comparing base (8d49e9a) to head (38b4803).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@james-d-mitchell james-d-mitchell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some superficial changes, then I'm happy to merge this

Comment thread doc/attr.xml
<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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
See also <Ref Oper="IsDigraphOutDominatingSet"/> for a further
See also <Ref Oper="IsDigraphOutDominatingSet"/> for further

Comment thread doc/attr.xml
in-dominating set</E> of <A>digraph</A> with respect to the ordering
<M>1 &lt; 2 &lt; ... &lt; 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>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Comment thread doc/oper.xml
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
See also <Ref Oper="IsDigraphOutDominatingSet"/> for a further
See also <Ref Oper="IsDigraphOutDominatingSet"/> for further

Comment thread doc/oper.xml
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>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the <Ref Attr="DigraphDual"/> of <A>digraph</A>.
the <Ref Attr="DigraphReverse"/> of <A>digraph</A>.

Same comment as above.

Comment thread doc/weights.xml
</ManSection>
<#/GAPDoc>


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

No change required in this file.

Comment thread gap/attr.gi
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not important, but can you possibly reflow this comment, the line breaks look weird to me.

Comment thread gap/attr.gi
return 0;
fi;

EdgeD := UnitEdgeWeightedDigraph(DigraphImmutableCopyIfMutable(digraph));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this line down to just before if Length(D) > 1 then no point in doing this here, again a minor point.

Comment thread gap/attr.gi
fi;

return Minimum(min,
Minimum(Minimum(OutDegrees(EdgeD)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimum is associative, no? So this could just be Minimum(min, Minimum(OutDegrees(EdgeD)), Minimum(InDegrees(EdgeD)), right?

Comment thread gap/oper.gi
Comment on lines +2563 to +2564
if not Length(vertex_order) = DigraphNrVertices(digraph) or
not Set(vertex_order) = DigraphVertices(digraph) then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment thread gap/oper.gi
[IsDigraph, IsList],
function(digraph, vertex_order)
if not Length(vertex_order) = DigraphNrVertices(digraph) or
not Set(vertex_order) = DigraphVertices(digraph) then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants