I would like to generate a grandom graph in R using any of the packages.
The desired output would be a two column matrix with the first column listing agents and the second column their connections of the following form:
1 3
1 4
1 6
1 7
2 2
2 5
3 9
3 11
3 32
3 43
3 2
4 5
I would like to be able to specify the average degree and minimum and maximum number of contacts.
What is the easiest way of doing this?
Since you don’t specify the need for anything other than just a graph we ca do this very simply:
if you want something more specific have a look at
igraphfor instanceor using package
bipartitewhich focuses specifically on two mode networks:There are many things to take into account, for instance if you want to constrain the degree distribution, probablity of ties between agents etc.