@@ -772,7 +772,27 @@ function(D, start, destination)
772772 return flows;
773773end );
774774
775- # DigraphEdgeConnectivity calculated using Spanning Trees
775+ # ############################################################################
776+ # Digraph Edge Connectivity
777+ # ############################################################################
778+
779+ # Algorithms constructed off the algorithms detailed in:
780+ # https://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf
781+ # Each Algorithm uses a different method to decrease the time complexity,
782+ # of calculating Edge Connectivity, though all make use of DigraphMaximumFlow()
783+ # due to the Max-Flow, Min-Cut Theorem
784+
785+ # Algorithm 1: Calculating the Maximum Flow of every possible source and sink
786+ # Algorithm 2: Calculating the Maximum Flow to all sinks of an arbitrary source
787+ # Algorithm 3: Finding Maximum Flow within the non-leaves of a Spanning Tree
788+ # Algorithm 4: Constructing a spanning tree with a high number of leaves
789+ # Algorithm 5: Using the spanning tree^ to find Maximum Flow within non-leaves
790+ # Algorithm 6: Finding Maximum Flow within a dominating set of the digraph
791+ # Algorithm 7: Constructing a dominating set for use in Algorithm 6
792+
793+ # Algorithms 4-7 are used below:
794+
795+ # DigraphEdgeConnectivity calculated using Spanning Trees (Algorithm 4 & 5)
776796InstallMethod(DigraphEdgeConnectivity, " for a digraph" ,
777797[ IsDigraph] ,
778798function (digraph )
@@ -816,7 +836,6 @@ function(digraph)
816836 Append(added, Difference(OutNeighbours(EdgeD)[ v] , added));
817837
818838 # Select the neighbour to v with the highest number of not-added neighbours:
819-
820839 notadded := Difference(VerticesED, added);
821840 max := 0 ;
822841 NextVertex := v;
@@ -839,17 +858,15 @@ function(digraph)
839858
840859 od ;
841860
842- # Algorithm 5: Using Algorithm 4 to find the Edge Connectivity
843-
861+ # Algorithm 5: Iterating through the non-leaves of the
862+ # Spanning Tree created in Algorithm 4 to find the Edge Connectivity
844863 non_leaf := [] ;
845864 for b in VerticesED do
846865 if not IsEmpty(OutNeighbours(st)[ b] ) then
847866 Append(non_leaf, [ b] );
848867 fi ;
849868 od ;
850869
851- # Get the smaller of non_leaf and Difference(Vertices in EdgeD, non_leaf)
852-
853870 if (Length(non_leaf) > 1 ) then
854871 u := non_leaf[ 1 ] ;
855872
@@ -872,6 +889,7 @@ function(digraph)
872889 else
873890 # In the case of spanning trees with only one non-leaf node,
874891 # the above algorithm does not work
892+ # Revert to iterating through all vertices of the original digraph
875893
876894 u := 1 ;
877895 for v in [ 2 .. DigraphNrVertices(EdgeD)] do
@@ -897,7 +915,7 @@ function(digraph)
897915 return min;
898916end );
899917
900- # Digraph EdgeConnectivity calculated with Dominating Sets
918+ # Digraph EdgeConnectivity calculated with Dominating Sets (Algorithm 6-7)
901919InstallMethod(DigraphEdgeConnectivityDS, " for a digraph" ,
902920[ IsDigraph] ,
903921function (digraph )
@@ -923,10 +941,10 @@ function(digraph)
923941 min := - 1 ;
924942
925943 # Algorithm 7: Creating a dominating set of the digraph
926-
944+
927945 D := DigraphDominatingSet(digraph);
928946
929- # Algorithm 6:
947+ # Algorithm 6: Using the dominating set created to determine the Maximum Flow
930948
931949 if Length(D) > 1 then
932950
@@ -945,6 +963,7 @@ function(digraph)
945963 else
946964 # If the dominating set of EdgeD is of Length 1,
947965 # the above algorithm will not work
966+ # Revert to iterating through all vertices of the original digraph
948967
949968 u := 1 ;
950969
0 commit comments