
    sg5
                     N    d dl Zd dlmZ d dlmZmZ d dlmZm	Z	m
Z
 d Zd Zd Zy)    N)assert_equal)reverse_cuthill_mckeestructural_rank)
csc_matrix
csr_matrix
coo_matrixc                     t        j                  g dg dg dg dg dg dg dg dgt              } t        |       }t	        |      }t        j                  g d      }t        ||       |j                  j                  d	      |_        |j                  j                  d	      |_        t	        |d
      }t        ||       y )N)   r   r   r   r
   r   r   r   )r   r
   r
   r   r   r
   r   r
   )r   r
   r
   r   r
   r   r   r   )r   r   r   r
   r   r   r
   r   )r
   r   r
   r   r
   r   r   r   )r   r
   r   r   r   r
   r   r
   dtype)            r
         r   int64T)	nparrayintr   r   r   indicesastypeindptr)Agraphpermcorrect_perms       ]/var/www/html/venv/lib/python3.12/site-packages/scipy/sparse/csgraph/tests/test_reordering.py test_graph_reverse_cuthill_mckeer      s    
*(((((((* 25	6A qME 'D8845L|$ MM((1EM<<&&w/EL -D|$    c                  ,   t        j                  dt              } t        j                  g d      }t        j                  g d      }t	        | ||ff      j                         }t        |      }t        j                  g d      }t        ||       y )N?   r   )?r   r   r   r   r   r
   r
   r
   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r      r#   r#   r#   	   r$   r$   
   r%   r%   r%   r%      r&   r&   r&      r'   r'      r(   r(   r(      r)   r)   r)      r*   r*   r*   r*   )?r   r   r   r#   r%   r
   r   r$   r&   r   r   r   r%   r
   r   r&   r   r   r'   r)   r   r   r(   r*   r   r   r)   r   r   r   r*   r   r#   r%   r(   r
   r$   r&   r   r   r#   r%   r*   r
   r   r$   r&   r   r'   r)   r   r#   r(   r*   r   r   r'   r)   r   r   r%   r(   r*   )r'   r)   r   r   r%   r#   r   r*   r   r(   r   r   r$   r&   r
   r   )r   onesr   r   r   tocsrr   r   )datarowscolsr   r   r   s         r   )test_graph_reverse_cuthill_mckee_orderingr0      s    772C D88 ( )D 88 " #D tDk*+113E 'D88 * +L|$r    c                     t        g dg dg dg      } t        t        |       d       t        j                  g d      }t        j                  g d      }t        j
                  |      }t        |||ffd      }t        t        |      d	       t        g d
g dg      }t        t        |      d       t        t        |j                        d       y )N)r
   r
   r   )r
   r   r
   )r   r
   r   r   )r   r   r   r   r   r
   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r
   r   r   r   r   r   r   r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   )r#   r#   )shaper   )r
   r   r   r   )r   r   r   r   r   )r   r   r   r   r   	ones_liker   T)r   r.   r/   r-   BCs         r   test_graph_structural_rankr7   2   s    I 	 A #Q' 88CDD88CDD<<DD$t%U3A#Q' 	L " 	#A#Q' %q)r    )numpyr   numpy.testingr   scipy.sparse.csgraphr   r   scipy.sparser   r   r   r   r0   r7    r    r   <module>r=      s#     & G ; ;%,%**r    