+
    )i%                        R t ^ RIHtHt ^ RIt^ RIHt . ROt]! R4      ]! R4      ]P                  R 4       4       4       t
R t]P                  R 4       t]P                  R	 4       t]P                  R
 4       t]! R4      ]! R4      ]P                  ! RR7      RR l4       4       4       t]! R4      ]! R4      ]P                  ! RR7      RR l4       4       4       tR# )z;Functions for computing and verifying matchings in a graph.)combinationsrepeatN)not_implemented_for
multigraphdirectedc                    \        4       p\        4       pV P                  4        FA  pVw  rEWB9  g   K  WR9  g   K  WE8w  g   K  VP                  V4       VP                  V4       KC  	  V# )aI  Find a maximal matching in the graph.

A matching is a subset of edges in which no node occurs more than once.
A maximal matching cannot add more edges and still be a matching.

Parameters
----------
G : NetworkX graph
    Undirected graph

Returns
-------
matching : set
    A maximal matching of the graph.

Examples
--------
>>> G = nx.Graph([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (4, 5)])
>>> sorted(nx.maximal_matching(G))
[(1, 2), (3, 5)]

Notes
-----
The algorithm greedily selects a maximal matching M of the graph G
(i.e. no superset of M exists). It runs in $O(|E|)$ time.
)setedgesaddupdateGmatchingnodesedgeuvs   &     Z/var/www/html/photoedit/myenv/lib/python3.14/site-packages/networkx/algorithms/matching.pymaximal_matchingr      sW    < uHEE	 >anLLLL  O    c                    \        4       pV P                  4        FG  pVw  r4WC3V9   g   W!9   d   K  W48X  d   \        P                  ! RV 24      hVP	                  V4       KI  	  V# )a  Converts matching dict format to matching set format

Converts a dictionary representing a matching (as returned by
:func:`max_weight_matching`) to a set representing a matching (as
returned by :func:`maximal_matching`).

In the definition of maximal matching adopted by NetworkX,
self-loops are not allowed, so the provided dictionary is expected
to never have any mapping from a key to itself. However, the
dictionary is expected to have mirrored key/value pairs, for
example, key ``u`` with value ``v`` and key ``v`` with value ``u``.

z%Selfloops cannot appear in matchings )r   itemsnxNetworkXErrorr
   )r   r	   r   r   r   s   &    r   matching_dict_to_setr   <   sc     EE 6U?dm6""%J4&#QRR		$ ! Lr   c                   \        V\        4      '       d   \        V4      p\        4       pV F  p\	        V4      ^8w  d   \
        P                  ! RV 24      hVw  rEW@9  g   WP9  d   \
        P                  ! RV R24      hWE8X  d    R# V P                  WE4      '       g    R# WB9   g   WR9   d    R# VP                  V4       K  	  R# )a[  Return True if ``matching`` is a valid matching of ``G``

A *matching* in a graph is a set of edges in which no two distinct
edges share a common endpoint. Each node is incident to at most one
edge in the matching. The edges are said to be independent.

Parameters
----------
G : NetworkX graph

matching : dict or set
    A dictionary or set representing a matching. If a dictionary, it
    must have ``matching[u] == v`` and ``matching[v] == u`` for each
    edge ``(u, v)`` in the matching. If a set, it must have elements
    of the form ``(u, v)``, where ``(u, v)`` is an edge in the
    matching.

Returns
-------
bool
    Whether the given set or dictionary represents a valid matching
    in the graph.

Raises
------
NetworkXError
    If the proposed matching has an edge to a node not in G.
    Or if the matching is not a collection of 2-tuple edges.

Examples
--------
>>> G = nx.Graph([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (4, 5)])
>>> nx.is_maximal_matching(G, {1: 3, 2: 4})  # using dict to represent matching
True

>>> nx.is_matching(G, {(1, 3), (2, 4)})  # using set to represent matching
True

matching has non-2-tuple edge matching contains edge  with node not in GFT	
isinstancedictr   r   lenr   r   has_edger   r   s   &&    r   is_matchingr$   U   s    R (D!!'1EEt9>""%CD6#JKK:""%<TFBU#VWW6zz!:T  r   c                d   \        V\        4      '       d   \        V4      p\        4       p\        4       pV F  p\	        V4      ^8w  d   \
        P                  ! RV 24      hVw  rVWP9  g   W`9  d   \
        P                  ! RV R24      hWV8X  d    R# V P                  WV4      '       g    R# WS9   g   Wc9   d    R# VP                  V4       VP                  V4       VP                  We34       K  	  V P                   F(  w  rVWV3V9  g   K  WS9  g   K  Wc9  g   K  WV8w  g   K'   R# 	  R# )a  Return True if ``matching`` is a maximal matching of ``G``

A *maximal matching* in a graph is a matching in which adding any
edge would cause the set to no longer be a valid matching.

Parameters
----------
G : NetworkX graph

matching : dict or set
    A dictionary or set representing a matching. If a dictionary, it
    must have ``matching[u] == v`` and ``matching[v] == u`` for each
    edge ``(u, v)`` in the matching. If a set, it must have elements
    of the form ``(u, v)``, where ``(u, v)`` is an edge in the
    matching.

Returns
-------
bool
    Whether the given set or dictionary represents a valid maximal
    matching in the graph.

Examples
--------
>>> G = nx.Graph([(1, 2), (1, 3), (2, 3), (3, 4), (3, 5)])
>>> nx.is_maximal_matching(G, {(1, 2), (3, 4)})
True

r   r   r   FT)r    r!   r   r   r"   r   r   r#   r   r
   r	   )r   r   r	   r   r   r   r   s   &&     r   is_maximal_matchingr&      s    > (D!!'1EEEEt9>""%CD6#JKK:""%<TFBU#VWW6zz!:T		$		1& $ 6~!.QV	 
 r   c                   \        V\        4      '       d   \        V4      p\        4       pV F  p\	        V4      ^8w  d   \
        P                  ! RV 24      hVw  rEW@9  g   WP9  d   \
        P                  ! RV R24      hWE8X  d    R# V P                  WE4      '       g    R# WB9   g   WR9   d    R# VP                  V4       K  	  \	        V4      \	        V 4      8H  # )a#  Return True if ``matching`` is a perfect matching for ``G``

A *perfect matching* in a graph is a matching in which exactly one edge
is incident upon each vertex.

Parameters
----------
G : NetworkX graph

matching : dict or set
    A dictionary or set representing a matching. If a dictionary, it
    must have ``matching[u] == v`` and ``matching[v] == u`` for each
    edge ``(u, v)`` in the matching. If a set, it must have elements
    of the form ``(u, v)``, where ``(u, v)`` is an edge in the
    matching.

Returns
-------
bool
    Whether the given set or dictionary represents a valid perfect
    matching in the graph.

Examples
--------
>>> G = nx.Graph([(1, 2), (1, 3), (2, 3), (2, 4), (3, 5), (4, 5), (4, 6)])
>>> my_match = {1: 2, 3: 5, 4: 6}
>>> nx.is_perfect_matching(G, my_match)
True

r   r   r   Fr   r   s   &&    r   is_perfect_matchingr(      s    @ (D!!'1EEt9>""%CD6#JKK:""%<TFBU#VWW6zz!:T  u:Qr   weight)
edge_attrsc                .  a \        V P                  4      ^ 8X  d   \        V RVR7      # V P                  V^R7      p^\        R V 4       4      ,           o\        P
                  ! 4       pV3R lV 4       pVP                  WAR7       \        VRVR7      # )ae  Compute a minimum-weight maximum-cardinality matching of `G`.

The minimum-weight maximum-cardinality matching is the matching
that has the minimum weight among all maximum-cardinality matchings.

Use the maximum-weight algorithm with edge weights subtracted
from the maximum weight of all edges.

A matching is a subset of edges in which no node occurs more than once.
The weight of a matching is the sum of the weights of its edges.
A maximal matching cannot add more edges and still be a matching.
The cardinality of a matching is the number of matched edges.

This method replaces the edge weights with 1 plus the maximum edge weight
minus the original edge weight.

new_weight = (max_weight + 1) - edge_weight

then runs :func:`max_weight_matching` with the new weights.
The max weight matching with these new weights corresponds
to the min weight matching using the original weights.
Adding 1 to the max edge weight keeps all edge weights positive
and as integers if they started as integers.

Read the documentation of `max_weight_matching` for more information.

Parameters
----------
G : NetworkX graph
  Undirected graph

weight: string, optional (default='weight')
   Edge data key corresponding to the edge weight.
   If key not found, uses 1 as weight.

Returns
-------
matching : set
    A minimal weight matching of the graph.

See Also
--------
max_weight_matching
T)maxcardinalityr)   )datadefaultc              3   ,   "   T F
  w   rVx  K  	  R # 5iN ).0_ws   &  r   	<genexpr>&min_weight_matching.<locals>.<genexpr>7  s     2'wq!'s   c              3   @   <"   T F  w  rq1VSV,
          3x  K  	  R # 5ir0   r1   )r2   r   r   r4   
max_weights   &   r   r5   r6   9  s     ;7aJN#7s   r)   )r"   r	   max_weight_matchingmaxr   Graphadd_weighted_edges_from)r   r)   G_edgesInvGr	   r8   s   &&   @r   min_weight_matchingr@     s    ` 177|q"1T&IIgg61g-GS2'222J88:D;7;E   6tDHHr   c                  a aaaaaaaaa a!a"a#a$a%a&a'a(a)a*  ! R R4      o ! V3R lR4      o\        S 4      o$S$'       g   \        4       # ^ pRpS P                  RR7       F]  w  rVpVP                  S^4      pWV8w  d	   W8  d   TpT;'       d.    \	        \        V4      4      P                  R4      ^,          R9   pK_  	  / o(/ o&/ o'\        \        S$S$4      4      o%\        \        S$\        R4      4      4      o"\        \        S$S$4      4      o / o\        \        S$\        V4      4      4      o#/ o!/ o. o)V V#V3R	 lo*VVVV V%V&V'V(V)3	R
 loVV V%V&V'V(3R lp	VV VV V!V"V%V&V'V(V)V*3R lp
VVVVV V!V"V%V&V'V(3R lpVV V"V(3R loVVV V%V&V'V(3R lpV V!V"V#V$V(VV3R lp S&P                  4        S'P                  4        SP                  4        S! F
  pRVn        K  	  SP                  4        . S)R&   S$ F2  pVS(9  g   K  S&P                  S%V,          4      e   K(  S! V^R4       K4  	  ^ p S)'       Ed   V'       Eg   S)P                  4       pS&S%V,          ,          ^8X  g   Q hS P                  V4       EFw  pVV8X  d   K  S%V,          pS%V,          pVV8X  d   K(  VV3S9  d   S*! VV4      pV^ 8:  d   R;SVV3&   SVV3&   VV3S9   d   S&P                  V4      f   S! V^V4       Kw  S&P                  V4      ^8X  d+   V	! VV4      pVSJd   V
! VVV4       K  V! VV4       ^p EK  S&P                  V4      f   S&V,          ^8X  g   Q h^S&V&   VV3S'V&   K  K  S&P                  V4      ^8X  d3   SP                  V4      e   XS*! SV,          !  8  d   VV3SV&   EK/  EK2  S&P                  V4      e   EKH  SP                  V4      e   XS*! SV,          !  8  g   EKp  VV3SV&   EKz  	  EK  V'       d   EMFRpR;p;ppS'       g   ^p\        S#P                  4       4      pS P!                  4        F^  pS&P                  S%V,          4      e   K  SP                  V4      f   K4  S*! SV,          !  pVR8X  g
   VV8  g   KQ  Tp^pSV,          pK`  	  S" F  pS"V,          e   K  S&P                  V4      ^8X  g   K(  SP                  V4      f   K=  S*! SV,          !  pV'       d   V^,          ^ 8X  g   Q hV^,          pM	VR,          pVR8X  g
   VV8  g   K  Tp^pSV,          pK  	  S! FL  pS"V,          e   K  S&P                  V4      ^8X  g   K(  VR8X  g   S!V,          V8  g   K?  S!V,          p^pTpKN  	  VR8X  d0   S'       g   Q h^p\#        ^ \        S#P                  4       4      4      pS$ Fk  pS&P                  S%V,          4      ^8X  d   S#V;;,          V,          uu&   K7  S&P                  S%V,          4      ^8X  g   KV  S#V;;,          V,          uu&   Km  	  S! Fj  pS"V,          e   K  S&P                  V4      ^8X  d   S!V;;,          V,          uu&   K=  S&P                  V4      ^8X  g   KU  S!V;;,          V,          uu&   Kl  	  V^8X  d   MV^8X  d?   Vw  ppS&S%V,          ,          ^8X  g   Q hR;SVV3&   SVV3&   S)P%                  V4       EK  V^8X  d?   Vw  ppR;SVV3&   SVV3&   S&S%V,          ,          ^8X  g   Q hS)P%                  V4       EK  V^8X  g   EK  V! VR4       EK  S( F  pS(S(V,          ,          V8X  d   K  Q h	  V'       g   Mj\        S!P'                  4       4       FJ  pVS!9  d   K  S"V,          e   K  S&P                  V4      ^8X  g   K1  S!V,          ^ 8X  g   KA  V! VR4       KL  	  EK=  V'       d   V! 4        \)        S(4      # )a  Compute a maximum-weighted matching of G.

A matching is a subset of edges in which no node occurs more than once.
The weight of a matching is the sum of the weights of its edges.
A maximal matching cannot add more edges and still be a matching.
The cardinality of a matching is the number of matched edges.

Parameters
----------
G : NetworkX graph
  Undirected graph

maxcardinality: bool, optional (default=False)
   If maxcardinality is True, compute the maximum-cardinality matching
   with maximum weight among all maximum-cardinality matchings.

weight: string, optional (default='weight')
   Edge data key corresponding to the edge weight.
   If key not found, uses 1 as weight.


Returns
-------
matching : set
    A maximal matching of the graph.

 Examples
--------
>>> G = nx.Graph()
>>> edges = [(1, 2, 6), (1, 3, 2), (2, 3, 1), (2, 4, 7), (3, 5, 9), (4, 5, 3)]
>>> G.add_weighted_edges_from(edges)
>>> sorted(nx.max_weight_matching(G))
[(2, 4), (5, 3)]

Notes
-----
If G has edges with weight attributes the edge data are used as
weight values else the weights are assumed to be 1.

This function takes time O(number_of_nodes ** 3).

If all edge weights are integers, the algorithm uses only integer
computations.  If floating point weights are used, the algorithm
could return a slightly suboptimal matching due to numeric
precision errors.

This method is based on the "blossom" method for finding augmenting
paths and the "primal-dual" method for finding a matching of maximum
weight, both methods invented by Jack Edmonds [1]_.

Bipartite graphs can also be matched using the functions present in
:mod:`networkx.algorithms.bipartite.matching`.

References
----------
.. [1] "Efficient Algorithms for Finding Maximum Matching in Graphs",
   Zvi Galil, ACM Computing Surveys, 1986.
c                       ] tR tRtRtRtR# )#max_weight_matching.<locals>.NoNodei  z-Dummy value which is different from any node.r1   N)__name__
__module____qualname____firstlineno____doc____static_attributes__r1   r   r   NoNoderC     s    ;r   rJ   c                   :   <a  ] tR tRt o Rt. ROtV3R ltRtV tR# )$max_weight_matching.<locals>.Blossomi  z7Representation of a non-trivial blossom or sub-blossom.c              3     <"   . V P                   OpV'       dF   VP                  4       p\        VS4      '       d   VP                  VP                   4       KG  Vx  KM  R # 5ir0   )childspopr    extend)selfstacktBlossoms   &  r   leaves+max_weight_matching.<locals>.Blossom.leaves  sH     "dkkNEIIKa))LL*G s   A!AA!r1   N)rN   r	   mybestedges)	rD   rE   rF   rG   rH   	__slots__rU   rI   __classdictcell__)__classdict__rT   s   @r   rT   rL     s     E6		 	r   rT   Tr-   'Nc                    < SV ,          SV,          ,           ^SV ,          V,          P                  S^4      ,          ,
          # )   )get)r   r4   r   dualvarr)   s   &&r   slack"max_weight_matching.<locals>.slack  s3    qzGAJ&QqT!W[[-C)CCCr   c                   <	 S	V ,          pS
P                  V 4      f   S
P                  V4      e   Q hV;S
V &   S
V&   Ve   W 3;SV &   SV&   M
R ;SV &   SV&   R ;SV &   SV&   V^8X  dG   \        VS4      '       d"   SP                  VP                  4       4       R # SP	                  V4       R # V^8X  d   SV,          pS! SV,          ^V4       R # R # r0   )r_   r    rP   rU   append)r4   rS   r   bbaserT   assignLabelbestedgeblossombase	inblossomlabel	labeledgematequeues   &&&  r   rg   (max_weight_matching.<locals>.assignLabel  s    aLyy|#		!(<<<a58=+,&0IaL9Q<*..IaL9Q<$((hqk6!W%%QXXZ(Q!V q>DT
At, r   c                   < . pSpV SJd   SV ,          pSV,          ^,          '       d   SV,          pMSV,          ^8X  g   Q hVP                  V4       ^SV&   S	V,          f   SV,          S
9  g   Q hSp M^S	V,          ^ ,          S
SV,          ,          8X  g   Q hS	V,          ^ ,          p SV ,          pSV,          ^8X  g   Q hS	V,          ^ ,          p VSJg   K  YrK  V F  p^SV&   K
  	  V# )   )rd   )r   r4   pathrf   re   rJ   ri   rj   rk   rl   rm   s   &&   r   scanBlossom(max_weight_matching.<locals>.scanBlossom  s    vo!AQx!||"1~8q= =KKNE!H|#"1~T111 |A${1~*>>>>aLOaLQx1}$}aLO1AE!H  r   c                 &  < SV ,          pSV,          pSV,          pS! 4       pV SV&   R SV&   VSV&   . ;Vn         pW3.;Vn        pWC8w  d   VSV&   VP                  V4       VP                  SV,          4       SV,          ^8X  g4   SV,          ^8X  d$   SV,          ^ ,          SSV,          ,          8X  g   Q hSV,          ^ ,          pSV,          pK  VP                  V4       VP                  4        VP                  4        WS8w  d   VSV&   VP                  V4       VP                  SV,          ^,          SV,          ^ ,          34       SV,          ^8X  g4   SV,          ^8X  d$   SV,          ^ ,          SSV,          ,          8X  g   Q hSV,          ^ ,          pSV,          pK  SV,          ^8X  g   Q h^SV&   SV,          SV&   ^ SV&   VP	                  4        F.  pSSV,          ,          ^8X  d   SP                  V4       VSV&   K0  	  / p	V EF  p\        VS4      '       df   VP                  e   VP                  p
R Vn        MlVP	                  4        UUu. uF&  pSP                  V4       F  q!V8w  g   K  W3NK  	  K(  	  p
ppM)SP                  V4       Uu. uF  q$V8w  g   K  WB3NK  	  p
pV
 Fc  pVw  rSV,          V8X  d   YrSV,          pW8w  g   K(  SP                  V4      ^8X  g   K@  W9  g   S! W4      S! W,          !  8  g   K_  WV&   Ke  	  R SV&   EK  	  \        V	P                  4       4      Vn        R pR SV&   VP                   F  pS! V!  pVe
   VX8  g   K  TpTpK  	  VSV&   R # u uppi u upi r0   )rN   r	   rd   reverserU   r    rW   	neighborsr_   listvalues)rf   r   r4   bbbvbwre   rr   edgs
bestedgetonblistkijbj
mybestedgekslackmybestslackrT   r   rh   ri   blossomdualblossomparentrj   rk   rl   rm   rn   ra   s   &&&               r   
addBlossom'max_weight_matching.<locals>.addBlossom?  s\   t_q\q\IAab4&!$h !M"KKOKK	"&9>b	Q9R=#3tKO7L#L  "a A1BBh !M"KKOKK2q)9R=+;<=9>b	Q9R=#3tKO7L#L  "a A1BRyA~~a }	!AAYq\"a' QIaL  
B"g&&>>-^^F%)BN
 )+		(31Q[[^TUv^  F ,-;;r?F?aAg'2'?FQ<1$qq\G		"*.5;
AW3W%&rN   HRL7 8 Z..01
AAYF!Vk%9
$	 
 !7 Gs   &NN)N6Nc                    < VVVV	V
VVVVVV3R  lpV! W4      .pV'       d=   VR,          pV F  pVP                  V! WQ4      4        K0  	  VP                  4        KD  R# )c              3   V  <"   V P                    FY  pR SV&   \        VS4      '       d;   V'       d   SV,          ^ 8X  d   Vx  K6  VP                  4        F  pVSV&   K
  	  KT  VSV&   K[  	  V'       Egs   SP                  V 4      ^8X  Ed\   SSV ,          ^,          ,          pV P                   P	                  V4      pV^,          '       d    V\        V P                   4      ,          p^pMRpSV ,          w  r7V^ 8w  d   V^8X  d   V P                  V,          w  rMV P                  V^,
          ,          w  rR SV&   R SV	&   S! V^V4       R;SW3&   SW3&   WV,          pV^8X  d   V P                  V,          w  r7MV P                  V^,
          ,          w  rsR;SW73&   SWs3&   WV,          pK  V P                   V,          p
^;SV&   SV
&   W73;SV&   SV
&   R SV
&   WV,          pV P                   V,          V8w  d   V P                   V,          pSP                  V4      ^8X  d   WV,          pKK  \        VS4      '       d2   VP                  4        F  pSP                  V4      '       g   K   M	  MTpSP                  V4      '       dQ   SV,          ^8X  g   Q hSV,          V8X  g   Q hR SV&   R SSSV,          ,          &   S! V^SV,          ^ ,          4       WV,          pEK  SP                  V R 4       SP                  V R 4       SP                  V R 4       SV  SV  SV  R # 5i)NT)rN   r    rU   r_   indexr"   r	   rO   )re   endstagesr   
entrychildr   jstepr4   pqr|   r{   rT   	allowedgerg   rh   ri   r   r   rj   rk   rl   rm   s   &&          r   _recurse<max_weight_matching.<locals>.expandBlossom.<locals>._recurse  s    XX#'a a))KNa$7!"A+,IaL ", $%IaL  H%))A,!"3 'y|A7
HHNN:.q55QXX&AE E |1fz wwqz1 wwq1u~#E!H#E!H1a(<@@Iqf%	1&(9JAz wwqz1 wwq1u~<@@Iqf%	1&(9JA XXa['((a5901v5	!y}#
hhqkZ/ !Byy}) 
 !"g..!#A$yy|| % "-  yy||$Qx1},}(|r111#'a7;d;r?34#Aq)A,q/:JAIIaMM!T"LLD!a AAs&   .L)AL)6AL)FL)/L)BL)Nr   rd   rO   )re   r   r   rR   topr   rT   r   rg   rh   ri   r   r   rj   rk   rl   rm   s   &&    r   expandBlossom*max_weight_matching.<locals>.expandBlossom  sY    [	 [	D !&')CXa23  		 r   c                    < VVVV	3R  lpV! W4      .pV'       d;   VR,          pV F  pVP                  V! V!  4        K.  	  VP                  4        KB  R# )c              3   f  <"   TpS
V,          V 8w  d   S
V,          pK  \        VS4      '       d   W!3x  V P                  P                  V4      ;r4V^,          '       d    V\        V P                  4      ,          p^pMRpV^ 8w  d   WE,          pV P                  V,          pV^8X  d   V P                  V,          w  rgMV P                  V^,
          ,          w  rv\        VS4      '       d   W&3x  WE,          pV P                  V,          p\        VS4      '       d   W'3x  VSV&   VSV&   K  V P                  VR V P                  RV ,           V n        V P                  VR V P                  RV ,           V n        S	V P                  ^ ,          ,          S	V &   S	V ,          V8X  g   Q hR# 5i)   Nr   )r    rN   r   r"   r	   )re   r   rS   r   r   r   r4   xrT   ri   r   rm   s   &&      r   r   =max_weight_matching.<locals>.augmentBlossom.<locals>._recurse  sp     A"a'!!$!W%%fHHNN1%%A1uuS]" q&
HHQKA:771:DAq771q5>DAa))&L
HHQKa))&LQQxx|ahhrl2AHggabkAGGBQK/AG(!5KNq>Q&&&s   F.F1Nr   r   )
re   r   r   rR   r   argsrT   ri   r   rm   s
   &&    r   augmentBlossom+max_weight_matching.<locals>.augmentBlossom  sU    )	' )	'` ! )CXt_-  		 r   c                   < W3W33 F  w  r# S
V,          pSV,          ^8X  g   Q hSV,          f   S	V,          S9  g&   SV,          ^ ,          SS	V,          ,          8X  g   Q h\        VS4      '       d	   S! WB4       VSV&   SV,          f   K  SV,          ^ ,          pS
V,          pSV,          ^8X  g   Q hSV,          w  r#S	V,          V8X  g   Q h\        VS4      '       d	   S! Wc4       VSV&   K  	  R# )r   N)r    )r   r4   r   r   bsrS   btrT   r   ri   rj   rk   rl   rm   s   &&     r   augmentMatching,max_weight_matching.<locals>.augmentMatchingS  s    VaV$DA q\RyA~%~!"-+b/2MbM!$[_(==  b'**"2)QR=(bM!$q\RyA~%~ }"2!+++b'**"2)Q; %r   c                  H  < S'       d&   \        ^ \        SP                  4       4      ) 4      p M^ p \        SP                  4       4      V ,           ^ 8  g   Q h\        S4      ^ 8X  g!   \        SP                  4       4      ^ 8  g   Q hSP	                  RR7       EFd  w  rpVP                  S^4      pW8X  d   K!  SV,          SV,          ,           ^V,          ,
          pV.pV.pSVR,          ,          e"   VP                  SVR,          ,          4       K3  SVR,          ,          e"   VP                  SVR,          ,          4       K3  VP                  4        VP                  4        \        Wg4       F$  w  rW8w  d    MV^SV,          ,          ,          pK&  	  V^ 8  g   Q hSP                  V4      V8X  g   SP                  V4      V8X  g   EK=  SV,          V8X  d   SV,          V8X  g   Q hV^ 8X  d   EKe  Q h	  S F#  p
V
S9   d   K  SV
,          V ,           ^ 8X  d   K#  Q h	  S Fp  pSV,          ^ 8  g   K  \        VP                  4      ^,          ^8X  g   Q hVP                  R,           F#  w  rSV,          V8X  d   SV,          V8X  d   K#  Q h	  Kr  	  R# )    Tr[   N:r   Nr^   r   )	r;   minry   r"   r	   r_   rd   rv   zip)vdualoffsetr   r   dwtr   	iblossoms	jblossomsbir   r   re   r   r   r   r`   gnodesrm   r,   r)   s               r   verifyOptimum*max_weight_matching.<locals>.verifyOptimumt  s:    a#gnn&6"7!78KK7>>#${2a777;1$K,>,>,@(AQ(FFF wwDw)GA!vq!Bv
WQZ'!b&0AII	".:  y}!=>	".:  y}!=>i38QR(( 4 6M6xx{a488A;!#3Aw!|Q144Avv) *, AI'!*{":a"???  A1~!177|a'1,,,GGDMMDA7a<DGqL88 * r   :NNNg       @F)intlongr   )rx   r   r	   r_   strtypesplitr!   r   r   clearrW   rO   rw   r   ry   r   r;   rd   keysr   )+r   r,   r)   	maxweight
allintegerr   r   r   r   rs   r   r   r   r   re   r   	augmentedr4   r{   r|   r   rf   	deltatypedelta	deltaedgedeltablossomrT   rJ   r   rg   r   rh   ri   r   r   r`   r   rj   rk   rl   rm   rn   ra   s+   fff                       @@@@@@@@@@@@@@@@@r   r:   r:   >  sh   X< < 8 !WFu IJ777%aUU616bnITTSb]%8%8%=a%@O%S
	 & D E I S()I
 VVD\23M s66*+K H 3vvi012G
 K
 I ED
- -2   J\! \! \!~o oh= =B B)9 )9Z  	 	A AM 
 	 a A599Yq\#:#BAq$' 
 	 %		IIKYq\*a/// QAAv "1B"1BRx 1vY.!&q!!Q;DHHIq!f-	1a&0A1v* 99R=0 (1a0"YYr]a/ $/q!#4D#61 !+4A 6 !01 5,-	 %"YYq\1
 $)9>1>'(E!H,-q6IaL 2 2!+ $<<+3vxPR|@T7T,-q6HRL 8U1- $<<?2fuhqk?R6R+,a&HQKi (l  I/33E3I "	GNN,- WWY99Yq\*2x||A7Rx{+A B!e) !$%	$,QK	  #!!$,		!) Q3"HQK0F! &
q000"aK"SL B!e) !$%	$,QK	 #$ !!!$,		!)"bKNU,B'NE !I#$L ! B &%~	As7>>#345 99Yq\*a/AJ%'JYYy|,1AJ%'J  ! #+yy|q(#A%/1*#A%/ ! A~a"AYq\*a///8<<	1a&!Iq!f$5Qa"A8<<	1a&!Iq!f$5Yq\*a///QalE2
 AQ=A%%%   k&&()A#Q'EIIaLA,=+a.TUBUa&	 * %%r   )r$   r&   r(   r:   r@   r   r9   )Fr)   )rH   	itertoolsr   r   networkxr   networkx.utilsr   __all___dispatchabler   r   r$   r&   r(   r@   r:   r1   r   r   <module>r      s   A *  . \"Z $  ! #$N2 9 9x : :z 0  0 f \"Z X&4I ' ! #4In \"Z X&{& ' ! #{&r   