Got it, but this solution in my view has two problems, the first is how to ensure that the graph generated by igraph_erdos_renyi_game function has the average degree that I need; second I do not understand how to add (attach) the weights in this graph generated by the function erdos_renyi. The weights are stored in a square matrix (dimensions: number of examples).
Is there any function in igraph library, that before adding an edge to a graph checks if it already exists?
Sorry to bother you and thanks for your help.