L iE ddlZddlmZddlmZddlmZmZm Z m Z ejZ e dddddejddf dZy)N)issparse)convert_pydata_sparse_to_scipy)csgraph_to_densecsgraph_from_densecsgraph_masked_from_densecsgraph_from_maskedTFc |s |s td|g} | r| jtj| r| jtjt || }|s&t |r|jdk(r |j}t |r8|r(|j|jtd}nt||}ntjj|rF|r8|j} tj |j"t|}||| <ndt%|}nX|rGt'|||| | }|j} tj(|j"t }||| <nt+||| | }|j,d k7r td |j.d |j.dk7r td|S)z7Routine for validation and conversion of csgraph inputsz*Internal: dense or csr output must be true) accept_fvcsc)copyF) null_value)dtyper )r r nan_null infinity_null)r)r rrz#compressed-sparse graph must be 2-Drz,compressed-sparse graph must be shape (N, N)) ValueErrorappendnpinfnanrrformatTtocsrastypeDTYPErma isMaskedArraymaskarraydatarrasarrayrndimshape) csgraphdirectedr csr_output dense_output copy_if_densecopy_if_sparse null_value_innull_value_outrrr rs f/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/scipy/sparse/csgraph/_validation.pyvalidate_graphr. s ,EFFI  ,W JG (7+%0G)) mmm8??E?RG&w>JG   W % <K MG <??}}Q7==++GHH N)numpyr scipy.sparserscipy.sparse._sputilsrscipy.sparse.csgraph._toolsrrrrfloat64rrr.r/r-r6sE!@ -2"!&u!"266!% 6r/