|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.network.NetworkFactory
public class NetworkFactory
Creates a list of nodes with their links from various sources. Note: this class is not thread safe.
| Field Summary |
|---|
| Fields inherited from interface uchicago.src.sim.network.NetworkConstants |
|---|
ASCII, BINARY, DL, EXCEL, LARGE, SMALL |
| Method Summary | |
|---|---|
static java.util.List |
createRandomDensityNetwork(int size,
double density,
boolean allowLoops,
boolean isSymmetric,
java.lang.Class nodeClass,
java.lang.Class edgeClass)
Creates a RandomDensityNetwork. |
static java.util.List |
createSquareLatticeNetwork(int cols,
int rows,
boolean wrapAround,
int connectRadius,
java.lang.Class node,
java.lang.Class edge)
Creates a square lattice network. |
static java.util.List |
createUnlinkedNetwork(int numNodes,
java.lang.Class nodeClass)
Creates a list containing the specified number of nodes of the specified type. |
static java.util.List |
createWattsStrogatzNetwork(int size,
int connectRadius,
double rewireProb,
java.lang.Class node,
java.lang.Class edge)
Creates a classic W-S network small world network (ring substrate). |
static java.util.List |
getDLNetworkFromStream(java.io.InputStream stream,
java.lang.Class nodeClass,
java.lang.Class edgeClass,
int matrixType)
Creates a List of nodes (and their edges) from the specified InputStream. |
static java.util.List |
getNetwork(java.lang.String fileName,
int fileFormat,
java.lang.Class nodeClass,
java.lang.Class edgeClass)
Deprecated. use NetworkFactory(String, int, Class, Class, int)
instead. |
static java.util.List |
getNetwork(java.lang.String fileName,
int fileFormat,
java.lang.Class nodeClass,
java.lang.Class edgeClass,
int matrixType)
Creates a List of nodes (and their edges) from the specified file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.util.List getNetwork(java.lang.String fileName,
int fileFormat,
java.lang.Class nodeClass,
java.lang.Class edgeClass,
int matrixType)
The matrix is assumed to be square for both the dl and Excel formats.
For Excel, each worksheet is treated as a matrix, and any worksheets
that do not contain matrices will cause an error. The worksheet name
is treated as the matrix label unless the name begins with Sheet
(Excel's generic worksheet name). The format for excel files is that
imported and exported by UCINet. The first cell is empty, and the
node labels begin on this first row in the second column. The column
node labels begin in first column on the second row. The actual data
begins in cell 2,2. For example,
If the matrix has no node labels, RePast will expect the first row and
column to be blank and as before, for the data to begin in cell 2,2.
| first_label | second_label | ...
-------------+-------------+--------------+----
first_label | 0 | 1 | ...
-------------+-------------+--------------+----
second_label | 1 | 0 | ...
-------------+-------------+--------------+----
... | ... | ... | ...
The matrixType parameter refers to the size of the matrix elements, the ij values. A matrix of type of NetworkConstants.BINARY contains on 0 or 1 as elements. A matrix of type of NetworkConstants.SMALL contains values of -127 - 127 as elements. And a matrix of type NetworkConstants.LARGE contains anything else.
fileName - the name of the filefileFormat - the format of the file (NetworkFactory.DL
and NetworkFactory.EXCEL)nodeClass - specifies the class of the created nodesedgeClass - specified the class of the created edgesmatrixType - the type of the matrix. type refers to the size of the
matrix elements (ij values) and can be one of NetworkConstants.BINARY,
NetworkConstants.LARGE, NetworkConstants.SMALL
public static java.util.List getDLNetworkFromStream(java.io.InputStream stream,
java.lang.Class nodeClass,
java.lang.Class edgeClass,
int matrixType)
The matrixType parameter refers to the size of the matrix elements, the ij values. A matrix of type of NetworkConstants.BINARY contains on 0 or 1 as elements. A matrix of type of NetworkConstants.SMALL contains values of -127 - 127 as elements. And a matrix of type NetworkConstants.LARGE contains anything else.
stream - the InputStream to read the data from.nodeClass - specifies the class of the created nodesedgeClass - specified the class of the created edgesmatrixType - the type of the matrix. type refers to the size of the
matrix elements (ij values) and can be one of NetworkConstants.BINARY,
NetworkConstants.LARGE, NetworkConstants.SMALL
public static java.util.List getNetwork(java.lang.String fileName,
int fileFormat,
java.lang.Class nodeClass,
java.lang.Class edgeClass)
NetworkFactory(String, int, Class, Class, int)
instead.
The matrix is assumed to be square for both the dl and Excel formats.
For Excel, each worksheet is treated as a matrix, and any worksheets
that do not contain matrices will cause an error. The worksheet name
is treated as the matrix label unless the name begins with Sheet
(Excel's generic worksheet name). The format for excel files is that
imported and exported by UCINet. The first cell is empty, and the
node labels begin on this first row in the second column. The column
node labels begin in first column on the second row. The actual data
begins in cell 2,2. For example,
If the matrix has no node labels, RePast will expect the first row and
column to be blank and as before, for the data to begin in cell 2,2.
| first_label | second_label | ...
-------------+-------------+--------------+----
first_label | 0 | 1 | ...
-------------+-------------+--------------+----
second_label | 1 | 0 | ...
-------------+-------------+--------------+----
... | ... | ... | ...
fileName - the name of the filefileFormat - the format of the file (NetworkFactory.DL
and NetworkFactory.EXCEL)nodeClass - specifies the class of the created nodesedgeClass - specified the class of the created edges
public static java.util.List createUnlinkedNetwork(int numNodes,
java.lang.Class nodeClass)
public static java.util.List createSquareLatticeNetwork(int cols,
int rows,
boolean wrapAround,
int connectRadius,
java.lang.Class node,
java.lang.Class edge)
cols - the number of columns in the networkrows - the number of rows in the networkwrapAround - whether the links should wrap around the latticeconnectRadius - the connect radius of the networknode - the class to create the network nodes fromedge - the class to create the network edges from
public static java.util.List createRandomDensityNetwork(int size,
double density,
boolean allowLoops,
boolean isSymmetric,
java.lang.Class nodeClass,
java.lang.Class edgeClass)
size - the size of the network (number of nodes)allowLoops - whether self loops are allowedisSymmetric - whether the resulting network is to be symmetricnodeClass - the class for the network nodesedgeClass - the class for the network edges
public static java.util.List createWattsStrogatzNetwork(int size,
int connectRadius,
double rewireProb,
java.lang.Class node,
java.lang.Class edge)
Note that when connectRadius is > 1 there can be funny effects if the number of nodes is not a multiple of the radius. If it doesn't divide evenly, this leaves out the extra links.
size - the size (number of nodes) in the networkconnectRadius - the connect radius of the network.rewireProb - the edge rewire probabilitynode - the class to create the nodes fromedge - the class to create the edges from
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||