
    tKg	              	           d dl Zd dlmZmZ d dl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Zy)    N)
csr_matrixissparse)convert_pydata_sparse_to_scipy)csgraph_to_densecsgraph_from_densecsgraph_masked_from_densecsgraph_from_maskedTFc                    |s|st        d      t        |       } |s&t        |       r| j                  dk(  r| j                  } t        |       r#|rt        | t        |      } nt        | |      } nt        j                  j                  |       rF|r8| j                  }t        j                  | j                  t        |      } || |<   ndt        |       } nX|rGt        | |||
|	      } | j                  }t        j                   | j                  t              } || |<   nt#        | ||	|
      } | j$                  dk7  rt        d	      | j&                  d
   | j&                  d   k7  rt        d      | S )z7Routine for validation and conversion of csgraph inputsz*Internal: dense or csr output must be truecsc)dtypecopy)
null_value)r   r   nan_nullinfinity_null)r   )r   r   r      z#compressed-sparse graph must be 2-Dr      z,compressed-sparse graph must be shape (N, N))
ValueErrorr   r   formatTr   DTYPEr   npmaisMaskedArraymaskarraydatar	   r   asarrayr   ndimshape)csgraphdirectedr   
csr_outputdense_outputcopy_if_densecopy_if_sparsenull_value_innull_value_outr   r   r   s               d/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/scipy/sparse/csgraph/_validation.pyvalidate_graphr)      sH    ,EFF,W5G (7+%0G)) NKG&w>JG			W	%<<Dhhw||5}MG*GDM)'2G/5B;H9A>K	MG
 <<DjjU;G*GDM(]7D2:<G ||q>??}}Q7==++GHHN    )numpyr   scipy.sparser   r   scipy.sparse._sputilsr   scipy.sparse.csgraph._toolsr   r   r   r	   float64r   infr)    r*   r(   <module>r2      sE     - @ 
 	

 -2"!&u!"266!%	1r*   