diff --git a/doc/oper.xml b/doc/oper.xml
index 9213ec1b4..14d219026 100644
--- a/doc/oper.xml
+++ b/doc/oper.xml
@@ -2247,15 +2247,15 @@ false]]>
<#/GAPDoc>
-<#GAPDoc Label="DigraphDijkstra">
+<#GAPDoc Label="DigraphShortestPaths">
-
-
+
Two lists.
If digraph is a digraph and source and target are
- vertices of digraph, then DigraphDijkstra calculates the
+ vertices of digraph, then DigraphShortestPaths calculates the
length of the shortest path from source to target and returns
two lists. Each element of the first list is the distance of the
corresponding element from source. If a vertex was not visited in
@@ -2265,28 +2265,42 @@ false]]>
second list gives the previous vertex in the shortest path
from source to the corresponding vertex. For
source and for any vertices that remained unvisited this
- will be -1.
+ will be -1.
- If the optional second argument target is not present, then
- DigraphDijkstra returns the shortest path from source to
- every vertex that is reachable from source.
+ If the optional second argument target is not present, then
+ DigraphShortestPaths returns the shortest path from source to
+ every vertex that is reachable from source.
mat := [[0, 1, 1], [0, 0, 1], [0, 0, 0]];
[ [ 0, 1, 1 ], [ 0, 0, 1 ], [ 0, 0, 0 ] ]
gap> D := DigraphByAdjacencyMatrix(mat);
-gap> DigraphDijkstra(D, 2, 3);
+gap> DigraphShortestPaths(D, 2, 3);
[ [ infinity, 0, 1 ], [ -1, -1, 2 ] ]
-gap> DigraphDijkstra(D, 1, 3);
+gap> DigraphShortestPaths(D, 1, 3);
[ [ 0, 1, 1 ], [ -1, 1, 1 ] ]
-gap> DigraphDijkstra(D, 1, 2);
+gap> DigraphShortestPaths(D, 1, 2);
[ [ 0, 1, 1 ], [ -1, 1, 1 ] ]
]]>
<#/GAPDoc>
+<#GAPDoc Label="DigraphDijkstra">
+
+
+
+ Two lists.
+
+ This is an obsolete synonym for
+ and will
+ be removed in a future version.
+
+
+<#/GAPDoc>
+
<#GAPDoc Label="ModularProduct">
diff --git a/doc/z-chap4.xml b/doc/z-chap4.xml
index 4c1ac9304..dcd446926 100644
--- a/doc/z-chap4.xml
+++ b/doc/z-chap4.xml
@@ -91,6 +91,7 @@
<#Include Label="DigraphDegeneracyOrdering">
<#Include Label="HamiltonianPath">
<#Include Label="NrSpanningTrees">
+ <#Include Label="DigraphShortestPaths">
<#Include Label="DigraphDijkstra">
<#Include Label="DigraphVertexConnectivity">
<#Include Label="DigraphEdgeConnectivity">
diff --git a/gap/obsolete.gi b/gap/obsolete.gi
index 84c98088e..279583241 100644
--- a/gap/obsolete.gi
+++ b/gap/obsolete.gi
@@ -13,4 +13,6 @@ function(oldname, func)
Info(InfoWarning, 1, "use \"", NameFunction(func), "\" instead");
return CallFuncList(func, arg);
end);
-end);
\ No newline at end of file
+end);
+
+DIGRAPHS_DeclareObsoleteSynonym("DigraphDijkstra", DigraphShortestPaths);
\ No newline at end of file
diff --git a/gap/oper.gd b/gap/oper.gd
index ce77dc770..6c3a23bdb 100644
--- a/gap/oper.gd
+++ b/gap/oper.gd
@@ -129,9 +129,9 @@ DeclareOperation("DigraphKings", [IsDigraph, IsPosInt]);
DeclareOperation("DigraphFloydWarshall",
[IsDigraph, IsFunction, IsObject, IsObject]);
-DeclareOperation("DigraphDijkstra",
+DeclareOperation("DigraphShortestPaths",
[IsDigraph, IsPosInt]);
-DeclareOperation("DigraphDijkstra",
+DeclareOperation("DigraphShortestPaths",
[IsDigraph, IsPosInt, IsPosInt]);
DeclareOperation("DigraphConnectedComponent", [IsDigraph, IsPosInt]);
diff --git a/gap/oper.gi b/gap/oper.gi
index 638bf5331..589bab234 100644
--- a/gap/oper.gi
+++ b/gap/oper.gi
@@ -1900,7 +1900,7 @@ function(digraph, source, target)
while not IsEmpty(queue) do
u := Pop(queue);
u := u[2];
- # TODO: this has a small performance impact for DigraphDijkstraS,
+ # TODO: this has a small performance impact for DigraphShortestPaths,
# but do we care?
if u = target then
return [dist, prev];
@@ -1917,10 +1917,10 @@ function(digraph, source, target)
return [dist, prev];
end);
-InstallMethod(DigraphDijkstra, "for a digraph, a vertex, and a vertex",
+InstallMethod(DigraphShortestPaths, "for a digraph, a vertex, and a vertex",
[IsDigraph, IsPosInt, IsPosInt], DIGRAPHS_DijkstraST);
-InstallMethod(DigraphDijkstra, "for a digraph, and a vertex",
+InstallMethod(DigraphShortestPaths, "for a digraph, and a vertex",
[IsDigraph, IsPosInt],
{digraph, source} -> DIGRAPHS_DijkstraST(digraph, source, fail));
diff --git a/tst/standard/oper.tst b/tst/standard/oper.tst
index 1c3872fc6..5e248e5c9 100644
--- a/tst/standard/oper.tst
+++ b/tst/standard/oper.tst
@@ -2351,18 +2351,18 @@ gap> OutNeighbours(C);
[ [ 5, 6, 7 ], [ 7 ], [ 7 ], [ 7 ], [ 1, 6, 7 ], [ 1, 5, 7 ],
[ 3, 2, 1, 6, 5, 4 ] ]
-# DigraphDijkstra - when there is one path to target
+# DigraphShortestPaths - when there is one path to target
gap> mat := [[0, 1, 1], [0, 0, 1], [0, 0, 0]];
[ [ 0, 1, 1 ], [ 0, 0, 1 ], [ 0, 0, 0 ] ]
gap> gr := DigraphByAdjacencyMatrix(mat);
gap> DigraphShortestDistance(gr, 2, 3);
1
-gap> DigraphDijkstra(gr, 2, 3);
+gap> DigraphShortestPaths(gr, 2, 3);
[ [ infinity, 0, 1 ], [ -1, -1, 2 ] ]
-gap> DigraphDijkstra(gr, 1, 3);
+gap> DigraphShortestPaths(gr, 1, 3);
[ [ 0, 1, 1 ], [ -1, 1, 1 ] ]
-gap> DigraphDijkstra(gr, 1, 2);
+gap> DigraphShortestPaths(gr, 1, 2);
[ [ 0, 1, 1 ], [ -1, 1, 1 ] ]
gap> DigraphShortestDistance(gr, 1, 3);
1
@@ -2374,23 +2374,36 @@ gap> gr := DigraphByAdjacencyMatrix(mat);
gap> DigraphShortestDistance(gr, 2, 3);
fail
-gap> DigraphDijkstra(gr, 2, 3);
+gap> DigraphShortestPaths(gr, 2, 3);
[ [ infinity, 0, infinity ], [ -1, -1, -1 ] ]
gap> mat := [[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 0], [1, 0, 0, 0]];
[ [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 1, 0, 0 ], [ 1, 0, 0, 0 ] ]
gap> gr := DigraphByAdjacencyMatrix(mat);
-gap> DigraphDijkstra(gr, 1, 4);
+gap> DigraphShortestPaths(gr, 1, 4);
[ [ 0, 1, 1, 1 ], [ -1, 1, 1, 1 ] ]
gap> mat := [[0, 1, 1, 1], [0, 0, 1, 1], [0, 1, 0, 0], [1, 0, 0, 0]];
[ [ 0, 1, 1, 1 ], [ 0, 0, 1, 1 ], [ 0, 1, 0, 0 ], [ 1, 0, 0, 0 ] ]
gap> gr := DigraphByAdjacencyMatrix(mat);
-gap> DigraphDijkstra(gr, 1, 2);
+gap> DigraphShortestPaths(gr, 1, 2);
[ [ 0, 1, 1, 1 ], [ -1, 1, 1, 1 ] ]
-gap> DigraphDijkstra(gr, 1, 3);
+gap> DigraphShortestPaths(gr, 1, 3);
[ [ 0, 1, 1, 1 ], [ -1, 1, 1, 1 ] ]
+# DigraphShortestPaths - called by obsolete synonym DigraphDijkstra
+gap> L := InfoLevel(InfoWarning);;
+gap> SetInfoLevel(InfoWarning, 1);;
+gap> mat := [[0, 1, 1], [0, 0, 1], [0, 0, 0]];
+[ [ 0, 1, 1 ], [ 0, 0, 1 ], [ 0, 0, 0 ] ]
+gap> gr := DigraphByAdjacencyMatrix(mat);
+
+gap> DigraphDijkstra(gr, 2, 3) = DigraphShortestPaths(gr, 2, 3);
+#I "DigraphDijkstra" is obsolete and will be removed in a future version;
+#I use "DigraphShortestPaths" instead
+true
+gap> SetInfoLevel(InfoWarning, L);;
+
# ModularProduct
gap> ModularProduct(NullDigraph(0), CompleteDigraph(10));