ó
Ê½÷Xc           @` sˆ   d  d l  m Z m Z m Z d  d l Z d  d l m Z m Z d  d l	 m
 Z
 d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z d S(   i    (   t   divisiont   print_functiont   absolute_importN(   t   assert_equalt   assert_array_almost_equal(   t   csgraphc          C` s§   t  j d d d g d d d g d d d g g ƒ }  t j |  d d ƒ} xX | |  f D]J } t j | d t d d ƒ\ } } t | d ƒ t | d d d g ƒ qU Wd  S(   Ni    i   t
   null_valuet   directedt
   connectiont   weaki   (   t   npt   arrayR   t   csgraph_from_denset   connected_componentst   TrueR   R   (   t   Xdet   Xspt   Xt   n_componentst   labels(    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   test_weak_connections   s    c          C` s8  t  j d d d g d d d g d d d g g ƒ }  |  |  j } t j |  d d ƒ} t j | d d ƒ} xb | |  f D]T } t j | d t d d ƒ\ } } t | d ƒ | j ƒ  t	 | d d d g ƒ qw Wxb | | f D]T } t j | d t d d ƒ\ } } t | d ƒ | j ƒ  t	 | d d d g ƒ qÜ Wd  S(	   Ni    i   R   R   R   t   strongi   i   (
   R
   R   t   TR   R   R   R   R   t   sortR   (   t   X1det   X2det   X1spt   X2spR   R   R   (    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   test_strong_connections   s$    

c          C` sè   t  j d d d d d d g d d d d d d g d d d d d d g d d d d d d g d d d d d d g d d d d d d g g ƒ }  t j |  d t d d ƒ\ } } t | d ƒ | j ƒ  t | d d d d d d	 g ƒ d  S(
   Ni    i   R   R   R   i   i   i   i   (   R
   R   R   R   R   R   R   R   (   R   R   R   (    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   test_strong_connections24   s    
c          C` sè   t  j d d d d d d g d d d d d d g d d d d d d g d d d d d d g d d d d d d g d d d d d d g g ƒ }  t j |  d t d d ƒ\ } } t | d ƒ | j ƒ  t | d d d d d d g ƒ d  S(   Ni    i   R   R   R	   i   (   R
   R   R   R   R   R   R   R   (   R   R   R   (    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   test_weak_connections2C   s    
c          C` s¡   t  j d d d d g d d d d g d d d d g d d d d g g ƒ }  t j |  d d ƒ\ } } t | d ƒ t | d | d ƒ t | d | d ƒ d  S(   Ni    i   R   R   i   i   (   R
   R   R   R   R   (   t   gR   R   (    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   test_ticket1876R   s    c          C` s5   t  j d ƒ }  t j |  ƒ \ } } t | d ƒ d  S(   Ni   i   (   i   i   (   R
   t   onesR   R   R   (   R   R   R   (    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   test_fully_connected_graph`   s    (   t
   __future__R    R   R   t   numpyR
   t   numpy.testingR   R   t   scipy.sparseR   R   R   R   R   R    R"   (    (    (    sS   /tmp/pip-build-7oUkmx/scipy/scipy/sparse/csgraph/tests/test_connected_components.pyt   <module>   s   					