uchicago.src.sim.network
Class RandomDensityNet

java.lang.Object
  extended by uchicago.src.sim.network.RandomDensityNet

public class RandomDensityNet
extends java.lang.Object

Creates a RandomDensityNetwork. The network will have a density. (ratio of # of existing edges to the maximum possible # of edges) approximately equal to a specified double 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 density 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.

Unless there are compelling reasons to do otherwise, use the appropriate method in NetworkFactory to create a RandomDensityNetwork.

Version:
$Revision: 1.6 $ $Date: 2004/11/03 19:51:01 $
Author:
Skye Bender-deMoll

Constructor Summary
RandomDensityNet()
           
RandomDensityNet(java.lang.Class node, java.lang.Class edge)
           
RandomDensityNet(java.lang.Class node, java.lang.Class edge, int size)
           
RandomDensityNet(java.lang.Class node, java.lang.Class edge, int size, double dens, boolean allowLoops, boolean isSymmetric)
           
 
Method Summary
 java.util.ArrayList createRandomDensityNet()
          Returns an ArrayList network of size nodes of class nodeClass, connected with edges of class edgeClass.
 java.util.ArrayList createRandomDensityNet(java.lang.Class node, java.lang.Class edge, int size, double dens, boolean allowLoops, boolean isSymmetric)
          Sets the classes and parameters to the passed values and then calls createRandomDensityNet().
 double getDensity()
          Returns the double of the desired density of the network (ratio of number of existing edges to the maximum possible number of edges) Must be set before makeRandomDensityNet() is called.
 java.lang.Class getEdgeClass()
          Returns the Class of edges to be used in constructing the network.
 java.lang.Class getNodeClass()
          Returns the Class of nodes to be used in constructing the network.
 int getSize()
          Returns the int for the size (number of nodes) in the network to be constructed.
 boolean isAllowLoops()
          Returns true if self-loops will be permitted in the constructed network.
 boolean isSymmetric()
          Returns true if the constructed network will be symmetric.
 void setAllowLoops(boolean allow)
          Sets the whether self-loops will be permitted in the constructed network.
 void setDensity(double dens)
          Sets the double of the desired density of the network (ratio of number of existing edges to the maximum possible number of edges).
 void setEdgeClass(java.lang.Class edge)
          Sets the Class of edges to be used in constructing the network.
 void setNodeClass(java.lang.Class node)
          Sets the Class of nodes to be used in constructing the network.
 void setSize(int size)
          Sets the int for the size (number of nodes) in the network to be constructed.
 void setSymmetric(boolean sym)
          Sets whether the constructed network will be symmetric.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomDensityNet

public RandomDensityNet()

RandomDensityNet

public RandomDensityNet(java.lang.Class node,
                        java.lang.Class edge)

RandomDensityNet

public RandomDensityNet(java.lang.Class node,
                        java.lang.Class edge,
                        int size)

RandomDensityNet

public RandomDensityNet(java.lang.Class node,
                        java.lang.Class edge,
                        int size,
                        double dens,
                        boolean allowLoops,
                        boolean isSymmetric)
Method Detail

getNodeClass

public java.lang.Class getNodeClass()
Returns the Class of nodes to be used in constructing the network. Must be set before makeRandomDensityNet() is called.


setNodeClass

public void setNodeClass(java.lang.Class node)
Sets the Class of nodes to be used in constructing the network. Must be set before makeRandomDensityNet() is called.


getEdgeClass

public java.lang.Class getEdgeClass()
Returns the Class of edges to be used in constructing the network. Must be set before makeRandomDensityNet() is called.


setEdgeClass

public void setEdgeClass(java.lang.Class edge)
Sets the Class of edges to be used in constructing the network. Must be set before makeRandomDensityNet() is called.


getSize

public int getSize()
Returns the int for the size (number of nodes) in the network to be constructed. Must be set before makeRandomDensityNet() is called.


setSize

public void setSize(int size)
Sets the int for the size (number of nodes) in the network to be constructed. Must be set before makeRandomDensityNet() is called.


getDensity

public double getDensity()
Returns the double of the desired density of the network (ratio of number of existing edges to the maximum possible number of edges) Must be set before makeRandomDensityNet() is called.


setDensity

public void setDensity(double dens)
Sets the double of the desired density of the network (ratio of number of existing edges to the maximum possible number of edges). Must be set before makeRandomDensityNet() is called.


isAllowLoops

public boolean isAllowLoops()
Returns true if self-loops will be permitted in the constructed network. (Self-loops are edges from i to i)


setAllowLoops

public void setAllowLoops(boolean allow)
Sets the whether self-loops will be permitted in the constructed network. (Self-loops are edges from i to i)


isSymmetric

public boolean isSymmetric()
Returns true if the constructed network will be symmetric. (in a symmetric network, all ties i -> j = j -> i)


setSymmetric

public void setSymmetric(boolean sym)
Sets whether the constructed network will be symmetric. (in a symmetric network, all ties i -> j = j -> i)


createRandomDensityNet

public java.util.ArrayList createRandomDensityNet()
                                           throws java.lang.IllegalAccessException,
                                                  java.lang.InstantiationException
Returns an ArrayList network of size nodes of class nodeClass, connected with edges of class edgeClass. The network will have a density. (ratio of # of existing edges to the maximum possible # of edges) approximately equal to the double 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 density 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.

Because of the node and edge class instantiation, the makeNet() methods may throw an IllegalAccessException and/or InstantiationException and must be called from wit hen a try/ catch block, or remotely via the NetworkFactory class. Please use the appropriate method in NetworkFactory instead of this.

Throws:
IllegalAccessException, - InstantiationException
java.lang.IllegalAccessException
java.lang.InstantiationException

createRandomDensityNet

public java.util.ArrayList createRandomDensityNet(java.lang.Class node,
                                                  java.lang.Class edge,
                                                  int size,
                                                  double dens,
                                                  boolean allowLoops,
                                                  boolean isSymmetric)
                                           throws java.lang.IllegalAccessException,
                                                  java.lang.InstantiationException
Sets the classes and parameters to the passed values and then calls createRandomDensityNet().

Please use the appropriate method in NetworkFactory instead of this.

Throws:
IllegalAccessException, - InstantiationException
java.lang.IllegalAccessException
java.lang.InstantiationException