@@ -781,7 +781,27 @@ function(digraph, start, destination)
781781 return flows;
782782end );
783783
784- # DigraphEdgeConnectivity calculated using Spanning Trees
784+ # ############################################################################
785+ # Digraph Edge Connectivity
786+ # ############################################################################
787+
788+ # Algorithms constructed off the algorithms detailed in:
789+ # https://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf
790+ # Each Algorithm uses a different method to decrease the time complexity,
791+ # of calculating Edge Connectivity, though all make use of DigraphMaximumFlow()
792+ # due to the Max-Flow, Min-Cut Theorem
793+
794+ # Algorithm 1: Calculating the Maximum Flow of every possible source and sink
795+ # Algorithm 2: Calculating the Maximum Flow to all sinks of an arbitrary source
796+ # Algorithm 3: Finding Maximum Flow within the non-leaves of a Spanning Tree
797+ # Algorithm 4: Constructing a spanning tree with a high number of leaves
798+ # Algorithm 5: Using the spanning tree^ to find Maximum Flow within non-leaves
799+ # Algorithm 6: Finding Maximum Flow within a dominating set of the digraph
800+ # Algorithm 7: Constructing a dominating set for use in Algorithm 6
801+
802+ # Algorithms 4-7 are used below:
803+
804+ # DigraphEdgeConnectivity calculated using Spanning Trees (Algorithm 4 & 5)
785805InstallMethod(DigraphEdgeConnectivity, " for a digraph" ,
786806[ IsDigraph] ,
787807function (digraph )
@@ -825,7 +845,6 @@ function(digraph)
825845 Append(added, Difference(OutNeighbours(EdgeD)[ v] , added));
826846
827847 # Select the neighbour to v with the highest number of not-added neighbours:
828-
829848 notadded := Difference(VerticesED, added);
830849 max := 0 ;
831850 NextVertex := v;
@@ -848,17 +867,15 @@ function(digraph)
848867
849868 od ;
850869
851- # Algorithm 5: Using Algorithm 4 to find the Edge Connectivity
852-
870+ # Algorithm 5: Iterating through the non-leaves of the
871+ # Spanning Tree created in Algorithm 4 to find the Edge Connectivity
853872 non_leaf := [] ;
854873 for b in VerticesED do
855874 if not IsEmpty(OutNeighbours(st)[ b] ) then
856875 Append(non_leaf, [ b] );
857876 fi ;
858877 od ;
859878
860- # Get the smaller of non_leaf and Difference(Vertices in EdgeD, non_leaf)
861-
862879 if (Length(non_leaf) > 1 ) then
863880 u := non_leaf[ 1 ] ;
864881
@@ -881,6 +898,7 @@ function(digraph)
881898 else
882899 # In the case of spanning trees with only one non-leaf node,
883900 # the above algorithm does not work
901+ # Revert to iterating through all vertices of the original digraph
884902
885903 u := 1 ;
886904 for v in [ 2 .. DigraphNrVertices(EdgeD)] do
@@ -906,7 +924,7 @@ function(digraph)
906924 return min;
907925end );
908926
909- # Digraph EdgeConnectivity calculated with Dominating Sets
927+ # Digraph EdgeConnectivity calculated with Dominating Sets (Algorithm 6-7)
910928InstallMethod(DigraphEdgeConnectivityDS, " for a digraph" ,
911929[ IsDigraph] ,
912930function (digraph )
@@ -932,10 +950,10 @@ function(digraph)
932950 min := - 1 ;
933951
934952 # Algorithm 7: Creating a dominating set of the digraph
935-
953+
936954 D := DigraphDominatingSet(digraph);
937955
938- # Algorithm 6:
956+ # Algorithm 6: Using the dominating set created to determine the Maximum Flow
939957
940958 if Length(D) > 1 then
941959
@@ -954,6 +972,7 @@ function(digraph)
954972 else
955973 # If the dominating set of EdgeD is of Length 1,
956974 # the above algorithm will not work
975+ # Revert to iterating through all vertices of the original digraph
957976
958977 u := 1 ;
959978
0 commit comments