+
    Ai                     .    ^ RI t^ RItR tR tR tR tR# )    Nc                    V P                  V4       FS  pW,          V,          p RVR,          ^&   \        WV4       VR,          pWQVR.pWdR&   \        P                  ! W&4       KU  	  R#   \         d     L;i ; i)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   &&&    X/var/www/html/photoedit/myenv/lib/python3.14/site-packages/skimage/graph/_graph_merge.py_revalidate_node_edgesr      s    & }}T"y~	#(Da S, (^sD)	%[y, #  	 	s   A++A98A9c                4   V P                  V4       V P                  V,          P                  V P                  V,          4       V P                  V4       F-  pW,          V,          R,          pV P	                  W2RV/4       K/  	  V P                  V4       R# )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   )   sx     
7#	KKG 45w'^C *sh^4 ( 
g    c                8    RW,          V,          R,          ^&   R# )z*Invalidates the edge (n1, n2) in the heap.Fr   N )r   n1n2s   &&&r   r   r   6   s    $)EIbM+q!r   c                p   V'       d   VP                  4       p. pVP                  RR7       F.  w  rp
V
R,          pWV	R.p\        P                  ! W|4       WR&   K0  	  \	        V4      ^ 8  d   V^ ,          ^ ,          V8  d   \        P
                  ! V4      w  rrV'       g   KH  VP                  V4       F  p\        WV4       K  	  VP                  V	4       F  p\        WV4       K  	  V'       g"   VP                  4       p\        WV4       TTppMYppV! VVV4       VP                  VVV4      p\        VVV4       K  \        P                  ! V P                  4       ^,           4      p\        VP!                  RR7      4       F  w  pw  ppVR,           F  pVVV&   K
  	  K   	  VV ,          # )a  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   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_hierarchicalr?   ;   s   J hhjI		t	,(^R&	y, &[ - i.1
1a6!9 ==3r 5 }}R( #. ) }}R( #. ) "++-Sg.wSSSsC%__S#{;F"3	:		&**,*+I		t	 45
FQx[[E!Ie ! 6 Vr   )numpyr+   r	   r   r   r   r?   r    r   r   <module>rA      s!     !-H
*
Or   