static PyDiGraph.from_complex_adjacency_matrix(matrix, /, null_value=0j)#

Create a new PyDiGraph object from an adjacency matrix with matrix elements of type complex

This method can be used to construct a new PyDiGraph object from an input adjacency matrix. The node weights will be the index from the matrix. The edge weights will be a complex value of the value from the matrix.

This differs from the from_adjacency_matrix() in that the type of the elements of the input matrix in this method must be a complex (specifically a numpy.complex128) and the output graph edge weights will be complex too. While in from_adjacency_matrix() the matrix elements are of type float (specifically numpy.float64) and the edge weights in the output graph will be float too.

  • matrix (ndarray) – The input numpy array adjacency matrix to create a new PyDiGraph object from. It must be a 2 dimensional array and be a complex/np.complex128 data type.

  • null_value (complex) – An optional complex that will treated as a null value. If any element in the input matrix is this value it will be treated as not an edge. By default this is 0.0+0.0j


A new graph object generated from the adjacency matrix

Return type: