Skip to content

Commit f22c463

Browse files
committed
Grammar corrections
1 parent 367e18e commit f22c463

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

gap/attr.gi

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -701,24 +701,24 @@ end);
701701
# edges from <out[j]> to <out[i]> for all <i> greater than <j>.
702702

703703
InstallMethod(UnweightedBellmanFord, "for a digraph by out-neighbours",
704-
[IsDigraph,IsPosInt],
704+
[IsDigraph, IsPosInt],
705705
function(digraph, source)
706706
local distance, n, predecessor, i, inf, u, v, edge, w;
707707
n := DigraphNrVertices(digraph);
708-
#wouldn't work for weighted digraphs
709-
inf := n+1;
710-
distance := List([1..n],x->0);
711-
predecessor := List([1..n],x->0);
708+
# wouldn't work for weighted digraphs
709+
inf := n + 1;
710+
distance := List([1 .. n], x -> 0);
711+
predecessor := List([1 .. n], x -> 0);
712712
for i in DigraphVertices(digraph) do
713713
distance[i] := inf;
714714
predecessor[i] := 0;
715715
od;
716716
distance[source] := 0;
717-
for i in [1..n-1] do
717+
for i in [1 .. n - 1] do
718718
for edge in DigraphEdges(digraph) do
719719
u := edge[1];
720720
v := edge[2];
721-
#only works for unweighted graphs, w needs to be changed into a variable
721+
# only works for unweighted graphs, w needs to be changed into a variable
722722
w := 1;
723723
if distance[u] + w < distance[v] then
724724
distance[v] := distance[u] + w;
@@ -729,7 +729,7 @@ function(digraph, source)
729729
for edge in DigraphEdges(digraph) do
730730
u := edge[1];
731731
v := edge[2];
732-
#only works for unweighted graphs, w needs to be changed into a variable
732+
# only works for unweighted graphs, w needs to be changed into a variable
733733
w := 1;
734734
if distance[u] + w < distance[v] then
735735
Print("Graph contains a negative-weight cycle");
@@ -746,8 +746,6 @@ function(digraph, source)
746746
return [distance, predecessor];
747747
end);
748748

749-
750-
751749
InstallMethod(DigraphTopologicalSort, "for a digraph by out-neighbours",
752750
[IsDigraphByOutNeighboursRep],
753751
D -> DIGRAPH_TOPO_SORT(OutNeighbours(D)));

0 commit comments

Comments
 (0)