Class RandomDensityGenerator<T>

  • All Implemented Interfaces:
    NetworkGenerator<T>

    public class RandomDensityGenerator<T>
    extends AbstractGenerator<T>
    Generates a random network with a specified approximate density. The network is created by looping over all i, j node pairs and deciding on the existence of a link between the nodes by comparing the value of a probability to a uniform random number. If the boolean allowLoops is false, no self loops (links from i to itself) will be permitted. If the boolean isSymmetric is true, all ties will be bidirectional (i -> j = j -> i). This is what is generally referred to in the network literature as "random" network - a class of networks which have been well studied analytically, but which are structurally quite unlike most empirically observed "social" networks.
    Author:
    Nick Collier
    • Constructor Detail

      • RandomDensityGenerator

        public RandomDensityGenerator​(double density,
                                      boolean allowSelfLoops,
                                      boolean symmetric)
        Creates a random network.
        Parameters:
        density - the approximate desnity of the network
        allowSelfLoops - whether or not self loops are allowed in the created network
        symmetric - whether or not ties will be bidirectional in the created network
    • Method Detail

      • createNetwork

        public Network<T> createNetwork​(Network<T> network)
        Add edges to the existing network to create a random density network.
        Parameters:
        network - the network to add edges to
        Returns:
        the random network