|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.network.AbstractAdjacencyMatrix
uchicago.src.sim.network.AdjacencyByteMatrix
public class AdjacencyByteMatrix
A social network adjacency matrix. This is used as an itermediary data
structure when moving between Nodes and Edges
and other kinds of network representations. The matrix is assumed to
be square and that the rows and columns refer to the same nodes.
This matrix stores its elements as bytes, values of -127 - 127. Use
AdjacencyDoubleMatrix if you need to store
elements of larger values, and AdjacencyBitMatrix if you only
need to store values of 0 and 1.
Node,
Edge| Field Summary |
|---|
| Fields inherited from class uchicago.src.sim.network.AbstractAdjacencyMatrix |
|---|
comment, labels, matrixLabel |
| Constructor Summary | |
|---|---|
AdjacencyByteMatrix(byte[][] m)
Constructs an AdjacencyByteMatrix from the specified two dimensional byte array. |
|
AdjacencyByteMatrix(ByteMatrix2D matrix)
Constructs an AdjancencyByteMatrix using the specified matrix. |
|
AdjacencyByteMatrix(int rows,
int cols)
Constructs an AdjacencyByteMatrix with the specified number of rows and columns. |
|
AdjacencyByteMatrix(java.util.List labels)
Constructs an AdjacencyByteMatrix with the specified row/col labels. |
|
| Method Summary | |
|---|---|
int |
columns()
Returns the number of columns in the matrix. |
double |
get(int row,
int col)
Gets the value at row, col. |
double |
getAvgDegree()
Gets the average degree of this matrix. |
double |
getDensity()
Gets (computes) the density of this matrix. |
cern.colt.matrix.impl.DenseDoubleMatrix1D |
getRow(int row)
Gets the specified row of data for this matrix. |
java.lang.String |
matrixToString()
Returns a String representation of only the actual data matrix. |
int |
rows()
Returns the number of rows int matrix. |
void |
set(int row,
int col,
byte val)
Sets a data value in this matrix. |
void |
set(int row,
int col,
double val)
Sets a data value in this matrix. |
void |
setMatrix(byte[][] m)
Sets the matrix for this AdjacencyByteMatrix to the specified byte[][]. |
void |
setMatrix(cern.colt.matrix.impl.DenseDoubleMatrix2D m)
Copies the matrix elements from the specified DenseDoubleMatrix2D and casts them into bytes. |
java.lang.String |
toString()
Returns a String representation of this AdjacencyMatrix (comment etc.) |
| Methods inherited from class uchicago.src.sim.network.AbstractAdjacencyMatrix |
|---|
getComment, getLabels, getMatrixLabel, setComment, setMatrixLabel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AdjacencyByteMatrix(int rows,
int cols)
rows - the number of rows in the matrixcols - the number of cols in the matrixpublic AdjacencyByteMatrix(java.util.List labels)
labels - the row & column labelspublic AdjacencyByteMatrix(byte[][] m)
m - the 2D byte array to construct this AdjacencyMatrix from.public AdjacencyByteMatrix(ByteMatrix2D matrix)
matrix - the matrix data for this AdjacencyMatrix| Method Detail |
|---|
public void setMatrix(cern.colt.matrix.impl.DenseDoubleMatrix2D m)
m - the actual matrix data for this AdjacencyMatrixpublic void setMatrix(byte[][] m)
m - the actual matrix data for this AdjacencyMatrixpublic cern.colt.matrix.impl.DenseDoubleMatrix1D getRow(int row)
row - the index of the row to getpublic double getDensity()
public double getAvgDegree()
public void set(int row,
int col,
byte val)
row - the row index (i)col - the col index (j)
public void set(int row,
int col,
double val)
row - the row index (i)col - the col index (j)
public double get(int row,
int col)
row - the row index (i)col - the col index (j)
public int rows()
public int columns()
public java.lang.String matrixToString()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||