o
    Eb	                  	   @   s\   d dl Zd dlmZmZmZ ddlmZmZm	Z	m
Z
 ejZeddddd ejddf	ddZdS )	    N)
csr_matrix
isspmatrixisspmatrix_csc   )csgraph_to_densecsgraph_from_densecsgraph_masked_from_densecsgraph_from_maskedTFc                 C   s   |s|st d|st| r| j} t| r&|rt| t|d} nHt| |d} nAtj	| rD|r?| j
}tj| jt|d} || |< n(t| } n#|r_t| |||
|	d} | j
}tj| jtd} || |< nt| ||	|
d} | jdkrpt d| jd	 | jd
 kr~t d| S )z7Routine for validation and conversion of csgraph inputsz*Internal: dense or csr output must be true)dtypecopy)
null_value)r   r   nan_nullinfinity_null)r
   )r   r   r      z#compressed-sparse graph must be 2-Dr   r   z,compressed-sparse graph must be shape (N, N))
ValueErrorr   Tr   r   DTYPEr   npZmaZisMaskedArraymaskZarraydatar	   r   Zasarrayr   ndimshape)ZcsgraphZdirectedr
   Z
csr_outputZdense_outputZcopy_if_denseZcopy_if_sparseZnull_value_inZnull_value_outr   r   r    r   B/usr/lib/python3/dist-packages/scipy/sparse/csgraph/_validation.pyvalidate_graph	   sB   



r   )Znumpyr   Zscipy.sparser   r   r   Z_toolsr   r   r   r	   Zfloat64r   infr   r   r   r   r   <module>   s    