Random Two-mode Networks

When analysing network and computing measures, it is difficult to gauge whether the outcome is “high” or “low”. For example, is a 0.3 clustering coefficient high or low? Random networks based on an observed network can be used as to create a benchmark value. In other words, an observed value (e.g., a clustering coefficient) can be compared to the distribution of clustering coefficient from corresponding random networks.

There are many procedures or null models for creating random networks in one-mode networks. These procedures vary in how much they randomise an observed network. Traditionally, classical (also known as Bernoulli or Erdos-Reyni) random networks were the commonly used. These networks are constructed by using the same number of nodes, and assigning each dyad a uniform probability of having a tie based on the number of observed ties. In these networks, the degree distribution is uniform or Poisson. However, such a distribution rarely exist in reality. In fact, most real-world distributions are skewed. In response to the lack of comparability between observed networks and classical random networks, a set of randomisation procedures that maintain additional features has been developed. First, by reshuffling ties in an observed network, it is possible to create random networks that maintain each node’s number of ties as well as the overall number of nodes and ties (Molloy and Reed, 1995). Second, for weighted networks, it is also possible to reshuffle only the weights. By maintaining the ties and simply reshuffling tie weights, features based on connectedness are maintained (e.g., the size of the largest interconnected group of nodes; Opsahl et al., 2008).

The procedures for creating random networks in one-mode networks can be ported to two-mode networks. This page describes the counterparts to classical random network, tie reshuffled, and weighted reshuffled networks.

Classical Random Two-mode Networks

Classical random networks are created by setting the number of nodes and giving all possible ties a uniform probability of being formed. This probability is often the density of networks (i.e., number of directed ties or 2x undirected ties over Nx(N-1)). This procedure can be ported to two-mode networks by setting the numbers of primary and secondary nodes and giving all possible ties (i.e., ties between nodes in different groups) a uniform probability of being formed. To create corresponding networks, this probability would be using the two-mode density metric instead of the one-mode one: number of ties divided by the product of the numbers of primary and secondary nodes. This procedure is implemented in the function rg_tm in tnet.

Link Reshuffling

As nodes’ degree are not uniformely distributed, a second procedure for creating random networks consists in reshuffling the topology, reaching the maximally random network with the same degree distribution as the observed network (Maslov and Sneppen, 2002; Newman, 2003). For two-mode networks, a similar procedure can be conducted that ensures that nodes maintain their number of connections. This null model is implemented in the rg_reshuffling_tm-function with the option parameter set to “links”.

Weight Reshuffling

While the link reshuffling procedure can be applied to binary networks, another procedures is possible to use when dealing with weighted two-mode networks. The weight reshuffling procedure consists simply in reshuffling the weights globally in the network (Opsahl et al., 2008). This null model maintains the topology of the observed network. Therefore, the number of ties originating from a node (degree) does not change. Moreover, other features, such as the giant component does not change as well. This null model is also implemented in the rg_reshuffling_tm-function with the option parameter set to “weights”.

Want to test it with your data?

The randomisation procedures are implemented in tnet. First, you need to download and install tnet in R. Then, you need to create an edgelist of your network (see data structures in tnet for weighted two-mode networks). The commands below show how corresponding random networks to the Davis’ Southern Women data (Davis et al., 1941) can be created.

If you use any of the information on this page, please cite: Opsahl, T., 2013. Triadic closure in two-mode networks: Redefining the global and local clustering coefficients. Social Networks 35, doi:10.1016/j.socnet.2011.07.001

Like this:

I am using the rg_tm function to create a random network. I would like to know if there is a difference in the resulting degree distribution of the network if (1) I put in the exact number of ties (e.g. ties=300) or (2) if I Put in the probability of having a tie (e.g. ties=0.05).
For example that the degree in the second case is a Poisson distribution while in the first case there is no distribution function but just a single value.

The difference is the method used for creating the network. When you set the probability, each tie has this probability of being created — i.e., whether or not each individual tie exists is completely independent of the other ties. In the resulting network, there approximately -but not exactly be- (probability*n*(n-1)) ties. Conversely, if the number of ties is specified (e.g., ties=300), there will be exactly that amount of ties in the resulting network. In this case, the ties are not completely independent of each other as the number is fixed.

In terms of the degree distribution, both methods will create a classical random network with a Poisson distribution. If you would like to maintain a degree distribution, see the rg_reshuffling_tm-function.

I am extremely new to R and tnet, so please bear with me. I have several 2-mode networks and I am trying to compare their reinforcement and clustering measures with that of a random network. For one network I have come up with the following code to create a comparable random network:

As far as I can tell, this has worked fine. However, I would like to stabilize the random measurements by averaging the values from multiple random networks. Is there an easy way to do the above procedure to, for example, 1,000 random networks simultaneously and then output the averages of the resulting measures?

Hi Tore,
I have a two-mode, undirected, unweighted network. One mode are people, the other are projects that they participated in. I calculated (with all the code from your website! Thanks!) betweenness and so on. Now I want to create 1000 random networks and see if my estimates are significantly different from the random networks. Therefore I need to write a loop. I am not quite sure whether my code makes any sense. Can you take a look? There is no Error or something, but the output is quite confusing. I want to transfer the random network data into SPSS and calculate mean betweenness for example and than do some t-tests (or something else) in order to see if there is a significant difference. Have you done something like this already?
And if I print(tmp) the output is a list. But it should be 1000 different lists with the betweenness of each random network. Or am I mistaken?
Thank you for your help:)

Error in if (NC == 2) net <- data.frame(tmp[, 1], tmp[, 2]) :
argument is of length zero
In out5[i] <- projecting_tm(randonet5, "Newman") :
number of items to replace is not a multiple of replacement length

Please read up on the various data types in R. When you create a vector of numbers from 1 to 10, you can only replace each of these values with another value and not an object. If you would like to store objects within objects, use lists.