List of all classes, functions and methods in python-igraph
class Matrix:
Simple matrix data type.
Of course there are much more advanced matrix data types for Python (for instance, the ndarray data type of Numeric Python) and this implementation does not want to compete with them. The only role of this data type is to provide a convenient interface for the matrices returned by the Graph object (for instance, allow indexing with tuples in the case of adjacency matrices and so on).
Class Method | Fill |
Creates a matrix filled with the given value |
Class Method | Identity |
Creates an identity matrix. |
Class Method | Zero |
Creates a matrix filled with zeros. |
Method | __add__ |
Adds the given value to the matrix. |
Method | __eq__ |
Checks whether a given matrix is equal to another one |
Method | __getitem__ |
Returns a single item, a row or a column of the matrix |
Method | __hash__ |
Returns a hash value for a matrix. |
Method | __iadd__ |
In-place addition of a matrix or scalar. |
Method | __init__ |
Initializes a matrix. |
Method | __isub__ |
In-place subtraction of a matrix or scalar. |
Method | __iter__ |
Support for iteration. |
Method | __ne__ |
Checks whether a given matrix is not equal to another one |
Method | __plot__ |
Plots the matrix to the given Cairo context in the given box |
Method | __repr__ |
Undocumented |
Method | __setitem__ |
Sets a single item, a row or a column of the matrix |
Method | __str__ |
Undocumented |
Method | __sub__ |
Subtracts the given value from the matrix. |
Method | max |
Returns the maximum of the matrix along the given dimension |
Method | min |
Returns the minimum of the matrix along the given dimension |
Instance Variable | data |
Undocumented |
Property | shape |
Returns the shape of the matrix as a tuple |
Method | _get_data |
Returns the data stored in the matrix as a list of lists |
Method | _set_data |
Sets the data stored in the matrix |
Instance Variable | _data |
Undocumented |
Instance Variable | _ncol |
Undocumented |
Instance Variable | _nrow |
Undocumented |
Parameters | |
value | the value to be used |
*args | Undocumented |
shape | the shape of the matrix. Can be a single integer, two integers or a tuple. If a single integer is given here, the matrix is assumed to be square-shaped. |
Parameters | |
*args | Undocumented |
shape | the shape of the matrix. Can be a single integer, two integers or a tuple. If a single integer is given here, the matrix is assumed to be square-shaped. |
Parameters | |
*args | Undocumented |
shape | the shape of the matrix. Can be a single integer, two integers or a tuple. If a single integer is given here, the matrix is assumed to be square-shaped. |
Parameters | |
other | either a scalar or a matrix. Scalars will be added to each element of the matrix. Matrices will be added together elementwise. |
Returns | |
the result matrix |
Parameters | |
i | if a single integer, returns the ith row as a list. If a slice, returns the corresponding rows as another Matrix object. If a 2-tuple, the first element of the tuple is used to select a row and the second is used to select a column. |
Parameters | |
data | the elements of the matrix as a list of lists, or None to create a 0x0 matrix. |
Support for iteration.
This is actually implemented as a generator, so there is no need for a separate iterator class. The generator returns copies of the rows in the matrix as lists to avoid messing around with the internals. Feel free to do anything with the copies, the changes won't be reflected in the original matrix.
Plots the matrix to the given Cairo context in the given box
Besides the usual self-explanatory plotting parameters (context, bbox, palette), it accepts the following keyword arguments:
If only the row names or the column names are given and the matrix is square-shaped, the same names are used for both column and row names.
Parameters | |
i | if a single integer, sets the ith row as a list. If a slice, sets the corresponding rows from another Matrix object. If a 2-tuple, the first element of the tuple is used to select a row and the second is used to select a column. |
value | the new value |
Parameters | |
other | either a scalar or a matrix. Scalars will be subtracted from each element of the matrix. Matrices will be subtracted together elementwise. |
Returns | |
the result matrix |
Parameters | |
dim | the dimension. 0 means determining the column maximums, 1 means determining the row maximums. If None, the global maximum is returned. |