@@ -718,7 +718,8 @@ end);
718718InstallMethod(DigraphFromGraph6String, " for a string" ,
719719[ IsString] ,
720720function (s )
721- local FindCoord, list, n, start, maxedges, out, pos, i, bpos, edge, graph, j;
721+ local FindCoord, list, n, start, maxedges, out, pos, nredges, i, bpos, edge,
722+ gr, j;
722723
723724 s := Chomp(s);
724725
@@ -774,13 +775,11 @@ function(s)
774775 " the input string <s> is not in valid graph6 format," );
775776 fi ;
776777
777- out := EmptyPlist(n);
778- for i in [ 1 .. n] do
779- out[ i] := [] ;
780- od ;
778+ out := List([ 1 .. n] , x -> [] );
781779
782780 # Obtaining the adjacency vector
783781 pos := 1 ;
782+ nredges := 0 ;
784783 for j in [ start .. Length(list)] do # Every integer corresponds to 6 bits
785784 i := list[ j] ;
786785 bpos := 1 ;
@@ -791,15 +790,18 @@ function(s)
791790 edge := FindCoord(pos + 6 - bpos, 0 );
792791 out[ edge[ 1 ]][ LEN_LIST(out[ edge[ 1 ]] ) + 1 ] := edge[ 2 ] ;
793792 out[ edge[ 2 ]][ LEN_LIST(out[ edge[ 2 ]] ) + 1 ] := edge[ 1 ] ;
793+ nredges := nredges + 1 ;
794794 i := (i - 1 ) / 2 ;
795795 fi ;
796796 bpos := bpos + 1 ;
797797 od ;
798798 pos := pos + 6 ;
799799 od ;
800- graph := DigraphNC(out);
801- SetIsSymmetricDigraph(graph, true );
802- return graph;
800+ gr := DigraphNC(out, 2 * nredges);
801+ SetIsSymmetricDigraph(gr, true );
802+ SetIsMultiDigraph(gr, false );
803+ SetDigraphHasLoops(gr, false );
804+ return gr;
803805end );
804806
805807InstallMethod(DigraphFromDigraph6String, " for a string" ,
@@ -877,7 +879,7 @@ InstallMethod(DigraphFromSparse6String, "for a string",
877879[ IsString] ,
878880function (s )
879881 local list, n, start, blist, pos, num, bpos, k, range, source, len, v, i,
880- finish, x, j;
882+ finish, x, gr, j;
881883
882884 s := Chomp(s);
883885 # Check non-emptiness
@@ -984,11 +986,17 @@ function(s)
984986 fi ;
985987 i := i + k + 1 ;
986988 od ;
987-
989+
988990 # JDM bad!
989991 range := range + 1 ;
990992 source := source + 1 ;
991- return Digraph(rec (nrvertices := n, range := range, source := source));
993+ gr := Digraph(rec (nrvertices := n,
994+ nredges := len - 1 ,
995+ range := range,
996+ source := source));
997+ SetIsSymmetricDigraph(gr, true );
998+ SetIsMultiDigraph(gr, false );
999+ return gr;
9921000end );
9931001
9941002# one graph per line
0 commit comments