(mat, mat_label=None, show_weights=True, round_digits=3, directed=None, layout='dot')
Attempts to automatically determine the type of matrix by the type.
    A square matrix is interpreted to be an adjacency/stochastic matrix, while a non-square
    matrix is a edge-incidence matrix.
Attempts to automatically determine the type of matrix by the type.
    A square matrix is interpreted to be an adjacency/stochastic matrix, while a non-square
    matrix is a edge-incidence matrix.
Attempts to automatically determine the type of matrix by the type . A square matrix is interpreted to be an adjacency / stochastic matrix while a non - square matrix is a edge - incidence matrix .
def draw_matrix(mat, mat_label=None, show_weights=True, round_digits=3, directed=None, layout='dot'):
    '''
    Attempts to automatically determine the type of matrix by the type.
    A square matrix is interpreted to be an adjacency/stochastic matrix, while a non-square
    matrix is a edge-incidence matrix.
    '''

    mat = mat.T

    if len(mat.shape) != 2:
        raise Exception(f"Input matrix has wrong dimensionality (gotten {len(mat.shape)}, expected 2).")
    if directed is None:
        if mat.shape[0] == mat.shape[1]:
            directed = not np.allclose(mat.T, mat)
        else:
            directed = True
    if mat_label is None:
        mat_label = list(range(mat.shape[1]))

    if mat.shape[0] == mat.shape[1] and not np.any(mat < 0):
        return _draw_adj_matrix(mat, mat_label, show_weights, round_digits, directed, layout)
    else:
        return _draw_edge_inc_matrix(mat, mat_label, round_digits, layout)
def draw_matrix ( mat , mat_label = None , show_weights = True , round_digits = 3 , directed = None , layout = 'dot' ) : mat = mat . T if len ( mat . shape ) != 2 : raise Exception ( f"Input matrix has wrong dimensionality (gotten {len(mat.shape)}, expected 2)." ) if directed is None : if mat . shape [ 0 ] == mat . shape [ 1 ] : directed = not np . allclose ( mat . T , mat ) else : directed = True if mat_label is None : mat_label = list ( range ( mat . shape [ 1 ] ) ) if mat . shape [ 0 ] == mat . shape [ 1 ] and not np . any ( mat < 0 ) : return _draw_adj_matrix ( mat , mat_label , show_weights , round_digits , directed , layout ) else : return _draw_edge_inc_matrix ( mat , mat_label , round_digits , layout )