> By "Total number", I meant sum of edges (edges connected to the same node) > weight should be less than 1 in the same time each edge should have weight > from 0 to 1. There are many possible ways to do it. For instance, let us suppose that you have N nodes in your graph. In this case, no node will have more than N-1 incident edges (assuming that your graph is simple). In this case, you can simply draw random numbers from the range [0; 1/N] for each edge, and you can be absolutely sure that the sum of the weights of the incident edges won't exceed 1 for any node. Or, you could simply draw random numbers from the [0; 1] range and assign them as weights to the edges, then find the node with the largest total weight for its incident edges, and divide *all* the edge weights with this number. Or, you could divide the weights of the edges incident on the node only, and the find the next node with the largest total weight as long as you have at least one node where this weight is larger than 1. But _none_ of these methods guarantees uniform sampling from the space of all possible edge combinations, and if you want to be able to sample uniformly (and for all practical purposes I think you should), then that's a far more complicated problem.
-- T. _______________________________________________ igraph-help mailing list igraph-help@nongnu.org https://lists.nongnu.org/mailman/listinfo/igraph-help