From 126cbb24433fc5722e9810da0c99d238994efd43 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 22:41:57 +0100 Subject: [PATCH 01/20] Digraph radius, periphery, centre --- gap/attr.gd | 5 +++++ gap/attr.gi | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/gap/attr.gd b/gap/attr.gd index 7afe2359e..0bddfa83f 100644 --- a/gap/attr.gd +++ b/gap/attr.gd @@ -141,3 +141,8 @@ DeclareProperty("IsLowerSemimodularDigraph", IsDigraph); DeclareAttribute("DigraphJoinTable", IsDigraph); DeclareAttribute("DigraphMeetTable", IsDigraph); + +DeclareOperation("DigraphDistanceMetrics", IsDigraph); +DeclareAttribute("DigraphRadius", IsDigraph); +DeclareAttribute("DigraphCenter", IsDigraph); +DeclareAttribute("DigraphPeriphery", IsDigraph); \ No newline at end of file diff --git a/gap/attr.gi b/gap/attr.gi index 345a24620..84e3d844b 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3431,3 +3431,34 @@ D -> DIGRAPHS_IsJoinSemilatticeAndJoinTable(D)[2]); InstallMethod(DigraphMeetTable, "for a digraph", [IsDigraph], D -> DIGRAPHS_IsMeetSemilatticeAndMeetTable(D)[2]); + +InstallMethod(DigraphDistanceMetrics, "for a digraph", +[IsDigraph], +function(G) + local ecc, v; + if not IsDigraph(G) then + Error("Input must be a digraph"); + elif not IsStronglyConnected(G) then + Error("Input digraph is not strongly connected; property undefined"); + fi; + ecc := []; + for v in [1 .. NrVertices(G)] do + Add(ecc, DigraphLongestDistanceFromVertex(G, v)); + od; + return rec( + Radius := Minimum(ecc), + Centre := Filtered([1 .. n], i -> ecc[i] = Minimum(ecc)), + Periphery := Filtered([1 .. n], i -> ecc[i] = Maximum(ecc))); +end); + +InstallMethod(DigraphRadius, "for a digraph", +[IsDigraph], +D -> DIGRAPHS_DigraphDistanceMetrics(D).Radius); + +InstallMethod(DigraphCentre, "for a digraph" +[IsDigraph], +D -> DIGRAPHS_DigraphDistanceMetrics(D).Centre); + +InstallMethod(DigraphPeriphery, "for a digraph", +[IsDigraph], +D -> DIGRAPHS_DigraphDistanceMetrics(D).Periphery); \ No newline at end of file From 4a3fbbbeaec4b75387647c6fd0ed62753956d66b Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 22:44:28 +0100 Subject: [PATCH 02/20] fixed attribute --- gap/attr.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/attr.gd b/gap/attr.gd index 0bddfa83f..29ea59f73 100644 --- a/gap/attr.gd +++ b/gap/attr.gd @@ -142,7 +142,7 @@ DeclareProperty("IsLowerSemimodularDigraph", IsDigraph); DeclareAttribute("DigraphJoinTable", IsDigraph); DeclareAttribute("DigraphMeetTable", IsDigraph); -DeclareOperation("DigraphDistanceMetrics", IsDigraph); +DeclareAttribute("DigraphDistanceMetrics", IsDigraph); DeclareAttribute("DigraphRadius", IsDigraph); DeclareAttribute("DigraphCenter", IsDigraph); DeclareAttribute("DigraphPeriphery", IsDigraph); \ No newline at end of file From 12c5b9bb8001ac34ce9e5898b806caa40bbb18f1 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 22:46:08 +0100 Subject: [PATCH 03/20] fixed local variable issues --- gap/attr.gi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 84e3d844b..5c643d3fe 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3447,8 +3447,8 @@ function(G) od; return rec( Radius := Minimum(ecc), - Centre := Filtered([1 .. n], i -> ecc[i] = Minimum(ecc)), - Periphery := Filtered([1 .. n], i -> ecc[i] = Maximum(ecc))); + Centre := Filtered([1 .. NrVertices(G)], i -> ecc[i] = Minimum(ecc)), + Periphery := Filtered([1 .. NrVertices(G)], i -> ecc[i] = Maximum(ecc))); end); InstallMethod(DigraphRadius, "for a digraph", From 561f59d724ef0a7a0b9020c652d30a8dbfc46f09 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 22:52:14 +0100 Subject: [PATCH 04/20] func changes --- gap/attr.gi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 5c643d3fe..97e3ceae4 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3438,17 +3438,17 @@ function(G) local ecc, v; if not IsDigraph(G) then Error("Input must be a digraph"); - elif not IsStronglyConnected(G) then + elif not IsStronglyConnectedDigraph(G) then Error("Input digraph is not strongly connected; property undefined"); fi; ecc := []; - for v in [1 .. NrVertices(G)] do + for v in [1 .. DigraphNrVertices(G)] do Add(ecc, DigraphLongestDistanceFromVertex(G, v)); od; return rec( Radius := Minimum(ecc), - Centre := Filtered([1 .. NrVertices(G)], i -> ecc[i] = Minimum(ecc)), - Periphery := Filtered([1 .. NrVertices(G)], i -> ecc[i] = Maximum(ecc))); + Centre := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Minimum(ecc)), + Periphery := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Maximum(ecc))); end); InstallMethod(DigraphRadius, "for a digraph", From c66f3b7eb4b65dcda38765027c33c667969482fe Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 22:53:48 +0100 Subject: [PATCH 05/20] fixed fun calling --- gap/attr.gi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 97e3ceae4..8697877e0 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3453,12 +3453,12 @@ end); InstallMethod(DigraphRadius, "for a digraph", [IsDigraph], -D -> DIGRAPHS_DigraphDistanceMetrics(D).Radius); +D -> DigraphDistanceMetrics(D).Radius); InstallMethod(DigraphCentre, "for a digraph" [IsDigraph], -D -> DIGRAPHS_DigraphDistanceMetrics(D).Centre); +D -> DigraphDistanceMetrics(D).Centre); InstallMethod(DigraphPeriphery, "for a digraph", [IsDigraph], -D -> DIGRAPHS_DigraphDistanceMetrics(D).Periphery); \ No newline at end of file +D -> DigraphDistanceMetrics(D).Periphery); \ No newline at end of file From a06da2271d8f86934fa86287b36da8f1f3482842 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 22:59:34 +0100 Subject: [PATCH 06/20] - --- gap/attr.gi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/attr.gi b/gap/attr.gi index 8697877e0..1c4c9c99f 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3455,7 +3455,7 @@ InstallMethod(DigraphRadius, "for a digraph", [IsDigraph], D -> DigraphDistanceMetrics(D).Radius); -InstallMethod(DigraphCentre, "for a digraph" +InstallMethod(MyDigraphCentre, "for a digraph" [IsDigraph], D -> DigraphDistanceMetrics(D).Centre); From 16d09e82ad572e79c82164b67f1a0e3c270e433d Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:01:48 +0100 Subject: [PATCH 07/20] commas --- gap/attr.gi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 1c4c9c99f..424d0107f 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3447,15 +3447,17 @@ function(G) od; return rec( Radius := Minimum(ecc), - Centre := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Minimum(ecc)), - Periphery := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Maximum(ecc))); + Centre := Filtered([1 .. DigraphNrVertices(G)], + i -> ecc[i] = Minimum(ecc)), + Periphery := Filtered([1 .. DigraphNrVertices(G)], + i -> ecc[i] = Maximum(ecc))); end); InstallMethod(DigraphRadius, "for a digraph", [IsDigraph], D -> DigraphDistanceMetrics(D).Radius); -InstallMethod(MyDigraphCentre, "for a digraph" +InstallMethod(MyDigraphCentre, "for a digraph", [IsDigraph], D -> DigraphDistanceMetrics(D).Centre); From 10eaefb32b7429261636619bb0171fde6f4340e4 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:04:11 +0100 Subject: [PATCH 08/20] typos --- gap/attr.gd | 2 +- gap/attr.gi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gap/attr.gd b/gap/attr.gd index 29ea59f73..69eb908f8 100644 --- a/gap/attr.gd +++ b/gap/attr.gd @@ -144,5 +144,5 @@ DeclareAttribute("DigraphMeetTable", IsDigraph); DeclareAttribute("DigraphDistanceMetrics", IsDigraph); DeclareAttribute("DigraphRadius", IsDigraph); -DeclareAttribute("DigraphCenter", IsDigraph); +DeclareAttribute("DigraphCentre", IsDigraph); DeclareAttribute("DigraphPeriphery", IsDigraph); \ No newline at end of file diff --git a/gap/attr.gi b/gap/attr.gi index 424d0107f..d2b20262e 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3447,7 +3447,7 @@ function(G) od; return rec( Radius := Minimum(ecc), - Centre := Filtered([1 .. DigraphNrVertices(G)], + DigraphCentre := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Minimum(ecc)), Periphery := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Maximum(ecc))); @@ -3457,9 +3457,9 @@ InstallMethod(DigraphRadius, "for a digraph", [IsDigraph], D -> DigraphDistanceMetrics(D).Radius); -InstallMethod(MyDigraphCentre, "for a digraph", +InstallMethod(DigraphCentre, "for a digraph", [IsDigraph], -D -> DigraphDistanceMetrics(D).Centre); +D -> DigraphDistanceMetrics(D).DigraphCentre); InstallMethod(DigraphPeriphery, "for a digraph", [IsDigraph], From a4b9f28e65e20467ff9cd3587c5463e975297aac Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:18:32 +0100 Subject: [PATCH 09/20] added tests --- gap/attr.gi | 2 +- tst/standard/attr.tst | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gap/attr.gi b/gap/attr.gi index d2b20262e..241d54be9 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3439,7 +3439,7 @@ function(G) if not IsDigraph(G) then Error("Input must be a digraph"); elif not IsStronglyConnectedDigraph(G) then - Error("Input digraph is not strongly connected; property undefined"); + fail; # Only defined for strongly connected digraphs fi; ecc := []; for v in [1 .. DigraphNrVertices(G)] do diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index 53e3126d1..fdcc762d2 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -3173,6 +3173,14 @@ true gap> B[14, 15] = z; true +# DigraphDistanceMetrics +gap> DigraphRadius(Digraph([[1, 2], [2, 3], [3, 4], [4, 5], [5]])); +fail +gap> DigraphCentre(Digraph([[2], [3], [1]])); +[ 1, 2, 3 ] +gap> DigraphPeriphery(CycleDigraph(13)); +[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ] + # DigraphAbsorptionProbabilities gap> gr := Digraph([[2, 3, 4], [3], [2], []]); From 0f631e09b34a8d99de1f4847244fa1b76c7bf46c Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:21:54 +0100 Subject: [PATCH 10/20] fixed lambda functions --- gap/attr.gi | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 241d54be9..ad8d6f979 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3435,22 +3435,21 @@ D -> DIGRAPHS_IsMeetSemilatticeAndMeetTable(D)[2]); InstallMethod(DigraphDistanceMetrics, "for a digraph", [IsDigraph], function(G) - local ecc, v; + local ecc, v, n; if not IsDigraph(G) then Error("Input must be a digraph"); elif not IsStronglyConnectedDigraph(G) then fail; # Only defined for strongly connected digraphs fi; ecc := []; - for v in [1 .. DigraphNrVertices(G)] do + n := DigraphNrVertices(G); + for v in [1 .. n] do Add(ecc, DigraphLongestDistanceFromVertex(G, v)); od; return rec( Radius := Minimum(ecc), - DigraphCentre := Filtered([1 .. DigraphNrVertices(G)], - i -> ecc[i] = Minimum(ecc)), - Periphery := Filtered([1 .. DigraphNrVertices(G)], - i -> ecc[i] = Maximum(ecc))); + DigraphCentre := Filtered([1 .. n],i -> ecc[i] = Minimum(ecc)), + Periphery := Filtered([1 .. n],i -> ecc[i] = Maximum(ecc))); end); InstallMethod(DigraphRadius, "for a digraph", From 3519123ad41e92573b57d49663412ac550623f87 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:24:26 +0100 Subject: [PATCH 11/20] temp --- gap/attr.gi | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index ad8d6f979..d2b20262e 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3435,21 +3435,22 @@ D -> DIGRAPHS_IsMeetSemilatticeAndMeetTable(D)[2]); InstallMethod(DigraphDistanceMetrics, "for a digraph", [IsDigraph], function(G) - local ecc, v, n; + local ecc, v; if not IsDigraph(G) then Error("Input must be a digraph"); elif not IsStronglyConnectedDigraph(G) then - fail; # Only defined for strongly connected digraphs + Error("Input digraph is not strongly connected; property undefined"); fi; ecc := []; - n := DigraphNrVertices(G); - for v in [1 .. n] do + for v in [1 .. DigraphNrVertices(G)] do Add(ecc, DigraphLongestDistanceFromVertex(G, v)); od; return rec( Radius := Minimum(ecc), - DigraphCentre := Filtered([1 .. n],i -> ecc[i] = Minimum(ecc)), - Periphery := Filtered([1 .. n],i -> ecc[i] = Maximum(ecc))); + DigraphCentre := Filtered([1 .. DigraphNrVertices(G)], + i -> ecc[i] = Minimum(ecc)), + Periphery := Filtered([1 .. DigraphNrVertices(G)], + i -> ecc[i] = Maximum(ecc))); end); InstallMethod(DigraphRadius, "for a digraph", From 5d81e188268d1acd113e36354331d7669fee0b53 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:27:21 +0100 Subject: [PATCH 12/20] fix indents --- gap/attr.gi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index d2b20262e..8b0af9506 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3446,10 +3446,10 @@ function(G) Add(ecc, DigraphLongestDistanceFromVertex(G, v)); od; return rec( - Radius := Minimum(ecc), - DigraphCentre := Filtered([1 .. DigraphNrVertices(G)], + Radius := Minimum(ecc), + DigraphCentre := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Minimum(ecc)), - Periphery := Filtered([1 .. DigraphNrVertices(G)], + Periphery := Filtered([1 .. DigraphNrVertices(G)], i -> ecc[i] = Maximum(ecc))); end); From 4684f3b0403c6cb4f780ef5c3c31c19772057b86 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:29:47 +0100 Subject: [PATCH 13/20] temp --- gap/attr.gi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/attr.gi b/gap/attr.gi index 8b0af9506..cd4268f49 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3439,7 +3439,7 @@ function(G) if not IsDigraph(G) then Error("Input must be a digraph"); elif not IsStronglyConnectedDigraph(G) then - Error("Input digraph is not strongly connected; property undefined"); + return fail fi; ecc := []; for v in [1 .. DigraphNrVertices(G)] do From e11fd250241adf60c259c552aa5494ece22b4d0c Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:32:31 +0100 Subject: [PATCH 14/20] revrert fail option --- gap/attr.gi | 2 +- tst/standard/attr.tst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index cd4268f49..8b0af9506 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3439,7 +3439,7 @@ function(G) if not IsDigraph(G) then Error("Input must be a digraph"); elif not IsStronglyConnectedDigraph(G) then - return fail + Error("Input digraph is not strongly connected; property undefined"); fi; ecc := []; for v in [1 .. DigraphNrVertices(G)] do diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index fdcc762d2..bd1ea8ee6 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -3174,8 +3174,8 @@ gap> B[14, 15] = z; true # DigraphDistanceMetrics -gap> DigraphRadius(Digraph([[1, 2], [2, 3], [3, 4], [4, 5], [5]])); -fail +gap> DigraphRadius(Digraph([[2], [3], [1]])); +infinity gap> DigraphCentre(Digraph([[2], [3], [1]])); [ 1, 2, 3 ] gap> DigraphPeriphery(CycleDigraph(13)); From 252e1d8fdf3de0fd2462d3f77938a61868508988 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Wed, 7 May 2025 23:34:08 +0100 Subject: [PATCH 15/20] test update --- tst/standard/attr.tst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index bd1ea8ee6..3c98a7c79 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -3174,7 +3174,7 @@ gap> B[14, 15] = z; true # DigraphDistanceMetrics -gap> DigraphRadius(Digraph([[2], [3], [1]])); +gap> DigraphRadius(CycleDigraph(5)); infinity gap> DigraphCentre(Digraph([[2], [3], [1]])); [ 1, 2, 3 ] From de526a48cc7f21e0c449f3f61d0b090fa8612e7c Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Fri, 9 May 2025 06:26:56 +0100 Subject: [PATCH 16/20] fix error where radius would get set to infinity for cycle graphs --- gap/attr.gi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/attr.gi b/gap/attr.gi index 8b0af9506..68b0be7f6 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3443,7 +3443,7 @@ function(G) fi; ecc := []; for v in [1 .. DigraphNrVertices(G)] do - Add(ecc, DigraphLongestDistanceFromVertex(G, v)); + Add(ecc, DigraphLongestDistanceFromVertex(DigraphRemoveLoops(G, v))); od; return rec( Radius := Minimum(ecc), From 1cd445f78c5daa8df9d1f63b5ece2ec13b61ddbb Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Fri, 9 May 2025 07:18:40 +0100 Subject: [PATCH 17/20] fix eccentricity error with loops attempt --- gap/attr.gi | 12 +++++++++--- tst/standard/attr.tst | 2 +- tst/standard/oper.tst | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 68b0be7f6..a8a011e70 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3435,15 +3435,21 @@ D -> DIGRAPHS_IsMeetSemilatticeAndMeetTable(D)[2]); InstallMethod(DigraphDistanceMetrics, "for a digraph", [IsDigraph], function(G) - local ecc, v; + local ecc, c, u, v; if not IsDigraph(G) then Error("Input must be a digraph"); elif not IsStronglyConnectedDigraph(G) then Error("Input digraph is not strongly connected; property undefined"); fi; ecc := []; - for v in [1 .. DigraphNrVertices(G)] do - Add(ecc, DigraphLongestDistanceFromVertex(DigraphRemoveLoops(G, v))); + for u in [1 .. DigraphNrVertices(G)] do + c := 0; + for v in [1 .. DigraphNrVertices(G)] do + if DigraphShortestDistance(G, u, v) > c then + c := DigraphShortestDistance(G, u, v); + fi; + Add(ecc, c)); + od; od; return rec( Radius := Minimum(ecc), diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index 3c98a7c79..1b2db89fd 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -3175,7 +3175,7 @@ true # DigraphDistanceMetrics gap> DigraphRadius(CycleDigraph(5)); -infinity +4 gap> DigraphCentre(Digraph([[2], [3], [1]])); [ 1, 2, 3 ] gap> DigraphPeriphery(CycleDigraph(13)); diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst index e8460bc84..b33ecd65a 100644 --- a/tst/standard/oper.tst +++ b/tst/standard/oper.tst @@ -3234,6 +3234,20 @@ gap> DigraphEdges(D); gap> DigraphVertexLabels(D); [ 1, 2, 3, 6, [ 4, 5 ] ] +# DigraphFromMeetTable +gap> DigraphFromMeetTable([[1, 1], [1, 2]]); + +gap> DigraphFromMeetTable([[1, 1, 1, 1], [1, 2, 1, 2], [1, 1, 3, 3], [1, 2, 3, 4]]); + +gap> DigraphFromMeetTable([[1, 3, 2], [2, 3, 1], [3, 3, 3]]); +fail + +# DigraphFromJoinTable +gap> DigraphFromJoinTable([[1, 3, 3], [3, 2, 3], [3, 3, 3]]); + +gap> DigraphFromJoinTable([[1, 3, 2], [2, 3, 1], [3, 3, 3]]); +fail + # DIGRAPHS_UnbindVariables gap> Unbind(C); gap> Unbind(D); From 3190ce4025318de2c552af4f40e75d3392abaeeb Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Fri, 9 May 2025 07:37:47 +0100 Subject: [PATCH 18/20] tests and lint --- gap/attr.gi | 2 +- tst/standard/oper.tst | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index a8a011e70..6e579dbba 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3448,7 +3448,7 @@ function(G) if DigraphShortestDistance(G, u, v) > c then c := DigraphShortestDistance(G, u, v); fi; - Add(ecc, c)); + Add(ecc, c)); od; od; return rec( diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst index b33ecd65a..e8460bc84 100644 --- a/tst/standard/oper.tst +++ b/tst/standard/oper.tst @@ -3234,20 +3234,6 @@ gap> DigraphEdges(D); gap> DigraphVertexLabels(D); [ 1, 2, 3, 6, [ 4, 5 ] ] -# DigraphFromMeetTable -gap> DigraphFromMeetTable([[1, 1], [1, 2]]); - -gap> DigraphFromMeetTable([[1, 1, 1, 1], [1, 2, 1, 2], [1, 1, 3, 3], [1, 2, 3, 4]]); - -gap> DigraphFromMeetTable([[1, 3, 2], [2, 3, 1], [3, 3, 3]]); -fail - -# DigraphFromJoinTable -gap> DigraphFromJoinTable([[1, 3, 3], [3, 2, 3], [3, 3, 3]]); - -gap> DigraphFromJoinTable([[1, 3, 2], [2, 3, 1], [3, 3, 3]]); -fail - # DIGRAPHS_UnbindVariables gap> Unbind(C); gap> Unbind(D); From 612054b5e9af195bb42afa16507e269cdd34b615 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Fri, 9 May 2025 07:44:43 +0100 Subject: [PATCH 19/20] indent fixes --- gap/attr.gi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gap/attr.gi b/gap/attr.gi index 6e579dbba..a52a5177d 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3445,11 +3445,11 @@ function(G) for u in [1 .. DigraphNrVertices(G)] do c := 0; for v in [1 .. DigraphNrVertices(G)] do - if DigraphShortestDistance(G, u, v) > c then - c := DigraphShortestDistance(G, u, v); + if u <> v then + c := Maximum(c, DigraphShortestDistance(G, u, v)); fi; - Add(ecc, c)); od; + Add(ecc, c)); od; return rec( Radius := Minimum(ecc), From 06a6e64f803fa642990feea47eb609db55d0eb79 Mon Sep 17 00:00:00 2001 From: Marcin Weremczuk Date: Fri, 9 May 2025 07:53:28 +0100 Subject: [PATCH 20/20] temp --- gap/attr.gi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/attr.gi b/gap/attr.gi index a52a5177d..c341082ff 100644 --- a/gap/attr.gi +++ b/gap/attr.gi @@ -3449,7 +3449,7 @@ function(G) c := Maximum(c, DigraphShortestDistance(G, u, v)); fi; od; - Add(ecc, c)); + Add(ecc, c); od; return rec( Radius := Minimum(ecc),