§
    1-PhÐ  ã                   ó.   — d dl Zd dlZd„ Zd„ Zd„ Zd„ ZdS )é    Nc                 óþ   — |                       |¦  «        D ]f}| |         |         }	 d|d         d<   t          | ||¦  «         n# t          $ r Y nw xY w|d         }|||dg}||d<   t          j        ||¦  «         ŒgdS )a¼  Handles validation and invalidation of edges incident to a node.

    This function invalidates all existing edges incident on `node` and inserts
    new items in `heap_list` updated with the valid weights.

    rag : RAG
        The Region Adjacency Graph.
    node : int
        The id of the node whose incident edges are to be validated/invalidated
        .
    heap_list : list
        The list containing the existing heap of edges.
    Fú	heap itemé   ÚweightTN)Ú	neighborsÚ_invalidate_edgeÚKeyErrorÚheapqÚheappush)ÚragÚnodeÚ	heap_listÚnbrÚdataÚwtÚ	heap_items          úZ/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/skimage/graph/_graph_merge.pyÚ_revalidate_node_edgesr      s¹   € ð& }Š}˜TÑ"Ô"ð -ð -ˆØ4Œy˜Œ~ˆð	à#(ˆDÔ˜aÑ Ý˜S $¨Ñ,Ô,Ð,Ð,øÝð 	ð 	ð 	ð ˆDð	øøøð
 (Œ^ˆØ˜˜s DÐ)ˆ	Ø%ˆˆ[ÑÝŒy )Ñ,Ô,Ð,Ð,ð-ð -s   §AÁ
AÁAc                 ó:  — |                       |¦  «         | j        |                              | j        |         ¦  «         |                      |¦  «        D ]/}| |         |         d         }|                      ||d|i¦  «         Œ0|                      |¦  «         dS )z)Rename `node_id` in `graph` to `copy_id`.r   N)Ú_add_node_silentÚnodesÚupdater   Úadd_edgeÚremove_node)ÚgraphÚnode_idÚcopy_idr   r   s        r   Ú_rename_noder   )   sŸ   € ð 
×Ò˜7Ñ#Ô#Ð#Ø	„KÔ×Ò ¤¨GÔ 4Ñ5Ô5Ð5àŠ˜wÑ'Ô'ð 5ð 5ˆØ7Œ^˜CÔ  Ô*ˆØŠs˜G h° ^Ñ4Ô4Ð4Ð4à	×ÒgÑÔÐÐÐó    c                 ó4   — d| |         |         d         d<   dS )z*Invalidates the edge (n1, n2) in the heap.Fr   r   N© )r   Ún1Ún2s      r   r   r   6   s   € à$)€Eˆ"„Iˆb„M+Ô˜qÑ!Ð!Ð!r   c                 óÐ  — |r|                      ¦   «         }g }|                     d¬¦  «        D ].\  }}	}
|
d         }|||	dg}t          j        ||¦  «         ||
d<   Œ/t	          |¦  «        dk    r	|d         d         |k     r÷t          j        |¦  «        \  }}}	}|r·|                     |¦  «        D ]}t          |||¦  «         Œ|                     |	¦  «        D ]}t          ||	|¦  «         Œ|s*|                     ¦   «         }t          ||	|¦  «         ||}}n||	}} ||||¦  «         | 
                    |||¦  «        }t          |||¦  «         t	          |¦  «        dk    r|d         d         |k     °÷t          j        |                      ¦   «         dz   ¦  «        }t          |                     d¬¦  «        ¦  «        D ]\  }\  }}|d         D ]}|||<   ŒŒ||          S )a1  Perform hierarchical merging of a RAG.

    Greedily merges the most similar pair of nodes until no edges lower than
    `thresh` remain.

    Parameters
    ----------
    labels : ndarray
        The array of labels.
    rag : RAG
        The Region Adjacency Graph.
    thresh : float
        Regions connected by an edge with weight smaller than `thresh` are
        merged.
    rag_copy : bool
        If set, the RAG copied before modifying.
    in_place_merge : bool
        If set, the nodes are merged in place. Otherwise, a new node is
        created for each merge..
    merge_func : callable
        This function is called before merging two nodes. For the RAG `graph`
        while merging `src` and `dst`, it is called as follows
        ``merge_func(graph, src, dst)``.
    weight_func : callable
        The function to compute the new weights of the nodes adjacent to the
        merged node. This is directly supplied as the argument `weight_func`
        to `merge_nodes`.

    Returns
    -------
    out : ndarray
        The new labeled array.

    T)r   r   r   r   é   Úlabels)ÚcopyÚedgesr
   r   ÚlenÚheappopr   r   Únext_idr   Úmerge_nodesr   ÚnpÚarangeÚmaxÚ	enumerater   )r&   r   ÚthreshÚrag_copyÚin_place_mergeÚ
merge_funcÚweight_funcÚ	edge_heapr"   r#   r   r   r   Ú_Úvalidr   r+   ÚsrcÚdstÚnew_idÚ	label_mapÚixÚnÚdÚlabels                            r   Úmerge_hierarchicalrA   ;   s9  € ðJ ð ØhŠh‰jŒjˆà€IØŸ	š	 t˜	Ñ,Ô,ð &ð &‰ˆˆBà(Œ^ˆØ˜˜R Ð&ˆ	ÝŒy )Ñ,Ô,Ð,ð &ˆˆ[ÑÐå
ˆi‰.Œ.˜1Ò
Ñ
 ¨1¤¨a¤°6Ò!9Ð!9Ý œ=¨Ñ3Ô3Ñˆˆ2ˆr5ð ð 	;ð —}’} RÑ(Ô(ð /ð /Ý   b¨#Ñ.Ô.Ð.Ð.à—}’} RÑ(Ô(ð /ð /Ý   b¨#Ñ.Ô.Ð.Ð.à!ð "ØŸ+š+™-œ-Ý˜S " gÑ.Ô.Ð.Ø˜wSà˜rSàˆJs˜C Ñ%Ô%Ð%Ø—_’_ S¨#¨{Ñ;Ô;ˆFÝ" 3¨°	Ñ:Ô:Ð:õ- ˆi‰.Œ.˜1Ò
Ð
 ¨1¤¨a¤°6Ò!9Ð!9õ0 ”	˜&Ÿ*š*™,œ,¨Ñ*Ñ+Ô+€IÝ §	¢	¨t 	Ñ 4Ô 4Ñ5Ô5ð "ð "‰
ˆ‰FˆQØx”[ð 	"ð 	"ˆEØ!ˆIeÑÐð	"ð VÔÐr   )Únumpyr-   r
   r   r   r   rA   r!   r   r   ú<module>rC      sf   ðØ Ð Ð Ð Ø €€€ð!-ð !-ð !-ðH
ð 
ð 
ð*ð *ð *ð
Oð Oð Oð Oð Or   