|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.network.NetworkRecorder
public class NetworkRecorder
Records a network as a matrix or matrices in the appropriate format. NetworkRecorder is used to take a list of Nodes and write the corresponding adjacency matrix to a file. Three file formats are supported: UCINet's dl, Excel, and ASCII. The actual network matrix is written out in this format, although RePast records relevant non-matrix information as well: a file header containing the constant parameters for the model and a timestamp, and a block header that contains header information relevant to the network data recorded beneath it. The block header will contain the value of any dynamic model parameters at the time a network was recorded, as well as any user comments (typically the current tick count).
The actual format of the file is thus:
Specifying the format then specifies the format for the network data. The
rest (file header and block header) will remain the same for all formats.
The actual network data can easily be cut and pasted out of the file.
file header
block_header_1
network data in the specified format
block_header_2
network data in the specified format
...
ASCII format will record the matrix and the matrix label in comma delimited plain text. Excel format will store it in an Excel file in a format suitable for importation into UCINet.
Note: Excel format should not be used as it is very time consuming and error prone to write to an Excel file. Use ASCII instead which is a plain text format suitable for importation into excel.
| Nested Class Summary | |
|---|---|
class |
NetworkRecorder.MatrixData
|
| Field Summary |
|---|
| Fields inherited from interface uchicago.src.sim.network.NetworkConstants |
|---|
ASCII, BINARY, DL, EXCEL, LARGE, SMALL |
| Constructor Summary | |
|---|---|
NetworkRecorder(int format,
java.lang.String fileName,
SimModel model)
Constructs a NetworkRecorder with the specified format and file name. |
|
| Method Summary | |
|---|---|
void |
record(java.util.List nodeList)
Deprecated. use record(List, String, int) instead. |
void |
record(java.util.List nodeList,
int matrixType)
Records the network described by the Nodes in nodeList. |
void |
record(java.util.List nodeList,
java.lang.String comment)
Deprecated. use record(List nodeList, String comment, int matrixType)
instead. |
void |
record(java.util.List nodeList,
java.lang.String comment,
int matrixType)
Records the network described by the Nodes in nodeList. |
void |
write()
Writes the networks recorded by record(...) to the file specified in the constructor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NetworkRecorder(int format,
java.lang.String fileName,
SimModel model)
fileType - the network file format (NetworkRecorder.DL,
NetworkRecorder.EXCEL, or NetworkRecorder.ASCII).fileName - the name of the file to write the recorded network(s) to.model - the model associated with this networkisBatch - whether this is a batch run or not| Method Detail |
|---|
public void record(java.util.List nodeList)
record(List, String, int) instead.
nodeList - the list of nodes that describe the network to record
public void record(java.util.List nodeList,
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. Matrix ij values are assigned the edge strength of an edge, so unless you have explicitly set an edge strength of greater than 1, use NetworkConstants.BINARY.
nodeList - the list of nodes that describe the network to recordmatrixType - 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 void record(java.util.List nodeList,
java.lang.String comment)
record(List nodeList, String comment, int matrixType)
instead.
nodeList - the list of nodes that describe the network to recordcomment - a comment associated with the network
public void record(java.util.List nodeList,
java.lang.String comment,
int matrixType)
nodeList - the list of nodes that describe the network to recordcomment - a comment associated with the networkmatrixType - 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.SMALLpublic void write()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||