@@ -1080,7 +1080,7 @@ function(D)
10801080 # alter the answer for the diameter/girth if necessary. This function is
10811081 # called, if appropriate, by DigraphDiameter and DigraphUndirectedGirth.
10821082
1083- if DigraphNrVertices (D) = 0 and IsImmutableDigraph(D) then
1083+ if DigraphHasNoVertices (D) and IsImmutableDigraph(D) then
10841084 SetDigraphDiameter(D, fail );
10851085 SetDigraphUndirectedGirth(D, infinity);
10861086 return rec (diameter := fail , girth := infinity);
@@ -1491,10 +1491,10 @@ end);
14911491
14921492InstallMethod(DegreeMatrix, " for a digraph" , [ IsDigraph] ,
14931493function (D )
1494- if DigraphNrVertices (D) = 0 then
1495- return [] ;
1494+ if DigraphHasAVertex (D) then
1495+ return DiagonalMat(OutDegrees(D)) ;
14961496 fi ;
1497- return DiagonalMat(OutDegrees(D)) ;
1497+ return [] ;
14981498end );
14991499
15001500InstallMethod(LaplacianMatrix, " for a digraph" , [ IsDigraph] ,
@@ -1815,7 +1815,7 @@ function(D)
18151815 SetDigraphAddAllLoopsAttr(D, C);
18161816 SetIsReflexiveDigraph(C, true );
18171817 SetIsMultiDigraph(C, ismulti);
1818- SetDigraphHasLoops(C, DigraphNrVertices (C) > 0 );
1818+ SetDigraphHasLoops(C, DigraphHasAVertex (C));
18191819 fi ;
18201820 return C;
18211821end );
@@ -2264,7 +2264,7 @@ InstallMethod(UndirectedSpanningForest, "for a digraph by out-neighbours",
22642264[ IsDigraphByOutNeighboursRep] ,
22652265function (D )
22662266 local C;
2267- if DigraphNrVertices (D) = 0 then
2267+ if DigraphHasNoVertices (D) then
22682268 return fail ;
22692269 fi ;
22702270 C := MaximalSymmetricSubdigraph(D)!. OutNeighbours;
@@ -2293,9 +2293,9 @@ InstallMethod(UndirectedSpanningForestAttr, "for an immutable digraph",
22932293InstallMethod(UndirectedSpanningTree, " for a mutable digraph" ,
22942294[ IsMutableDigraph] ,
22952295function (D )
2296- if DigraphNrVertices(D) = 0
2297- or not IsStronglyConnectedDigraph(D)
2298- or not IsConnectedDigraph(UndirectedSpanningForest(DigraphMutableCopy(D)))
2296+ if not (DigraphHasAVertex(D)
2297+ and IsStronglyConnectedDigraph(D)
2298+ and IsConnectedDigraph(UndirectedSpanningForest(DigraphMutableCopy(D) )))
22992299 then
23002300 return fail ;
23012301 fi ;
@@ -2309,7 +2309,7 @@ InstallMethod(UndirectedSpanningTreeAttr, "for an immutable digraph",
23092309[ IsImmutableDigraph] ,
23102310function (D )
23112311 local out;
2312- if DigraphNrVertices (D) = 0
2312+ if DigraphHasNoVertices (D)
23132313 or not IsStronglyConnectedDigraph(D)
23142314 or (HasMaximalSymmetricSubdigraphAttr(D)
23152315 and not IsStronglyConnectedDigraph(MaximalSymmetricSubdigraph(D)))
0 commit comments