@@ -780,3 +780,46 @@ function(digraph, start, destination)
780780
781781 return flows;
782782end );
783+
784+ # ############################################################################
785+ # 6. Random edge weighted digraphs
786+ # ############################################################################
787+
788+ BindGlobal(" DIGRAPHS_RandomEdgeWeightedDigraphFilt" ,
789+ function (arg... )
790+ local digraph, outs, weightsSource, weights;
791+ # Create random digraph
792+ digraph := CallFuncList(RandomDigraphCons, arg);
793+ outs := OutNeighbours(digraph);
794+
795+ # Unique weights are taken randomly from [1..nredges]
796+ weightsSource := Shuffle([ 1 .. DigraphNrEdges(digraph)] );
797+ weights := List(DigraphVertices(digraph),
798+ u -> List(outs[ u] , _ -> Remove(weightsSource)));
799+
800+ return EdgeWeightedDigraph(digraph, weights);
801+ end );
802+
803+ InstallMethod(RandomUniqueEdgeWeightedDigraph,
804+ " for a pos int" , [ IsPosInt] ,
805+ n -> RandomUniqueEdgeWeightedDigraph(IsImmutableDigraph, n));
806+
807+ InstallMethod(RandomUniqueEdgeWeightedDigraph,
808+ " for a pos int and a float" , [ IsPosInt, IsFloat] ,
809+ { n, p} -> RandomUniqueEdgeWeightedDigraph(IsImmutableDigraph, n, p));
810+
811+ InstallMethod(RandomUniqueEdgeWeightedDigraph,
812+ " for a pos int and a rational" , [ IsPosInt, IsRat] ,
813+ { n, p} -> RandomUniqueEdgeWeightedDigraph(IsImmutableDigraph, n, p));
814+
815+ InstallMethod(RandomUniqueEdgeWeightedDigraph,
816+ " for a function and a pos int" , [ IsFunction, IsPosInt] ,
817+ DIGRAPHS_RandomEdgeWeightedDigraphFilt);
818+
819+ InstallMethod(RandomUniqueEdgeWeightedDigraph,
820+ " for a function, a pos int, and a float" , [ IsFunction, IsPosInt, IsFloat] ,
821+ DIGRAPHS_RandomEdgeWeightedDigraphFilt);
822+
823+ InstallMethod(RandomUniqueEdgeWeightedDigraph,
824+ " for a function, a pos int, and a rational" , [ IsFunction, IsPosInt, IsRat] ,
825+ DIGRAPHS_RandomEdgeWeightedDigraphFilt);
0 commit comments