Template Function NetworKit::GraphTools::randomizeWeights

Function Documentation

template<class Distribution = std::uniform_real_distribution<edgeweight>>
void NetworKit::GraphTools::randomizeWeights(Graph &G, Distribution distr = std::uniform_real_distribution<edgeweight>{0, std::nexttoward(1.0, 2.0)})

Randomizes the weights of the given graph. The weights are uniformly distributed in the range [0, 1] by default, unless a different distribution is provided. However it is only strictly in-place for already weighted graphs. For unweighted graphs a copy is created before randomizing weights.

Parameters:
  • G – Directed input graph

  • distr – Random distribution