+
    �°³j•  ã                   ót   € R t ^ RIt^ RIHt R.t]! R4      ]! R4      ]P                  R 4       4       4       tR# )zŸProvides a function for computing the extendability of a graph which is
undirected, simple, connected and bipartite and contains at least one perfect matching.N)Únot_implemented_forÚmaximal_extendabilityÚdirectedÚ
multigraphc           
     ó  € \         P                  ! V 4      '       g   \         P                  ! R4      h\         P                  P	                  V 4      '       g   \         P                  ! R4      h\         P                  P                  V 4      w  r\         P                  P                  V 4      p\         P                  ! W4      '       g   \         P                  ! R4      hW#P                  4       ,           Uu. uF  qDW4,          3NK  	  ppV P                   UUu. uF'  w  rgWb9   d	   Wg3V9   g   Wa9   d   Wv3V9  d   Wg3MWv3NK)  	  ppp\         P                  ! 4       p	V	P                  V 4       V	P                  V4       \         P                  ! V	4      '       g   \         P                  ! R4      h\        R4      p
V F=  pV F4  p\        R \         P                   ! W›V4       4       4      pW­8  d   T
MTp
K6  	  K?  	  V
# u upi u uppi )uÌ  Computes the extendability of a graph.

The extendability of a graph is defined as the maximum $k$ for which `G`
is $k$-extendable. Graph `G` is $k$-extendable if and only if `G` has a
perfect matching and every set of $k$ independent edges can be extended
to a perfect matching in `G`.

Parameters
----------
G : NetworkX Graph
    A fully-connected bipartite graph without self-loops

Returns
-------
extendability : int

Raises
------
NetworkXError
   If the graph `G` is disconnected.
   If the graph `G` is not bipartite.
   If the graph `G` does not contain a perfect matching.
   If the residual graph of `G` is not strongly connected.

Notes
-----
Definition:
Let `G` be a simple, connected, undirected and bipartite graph with a perfect
matching M and bipartition (U,V). The residual graph of `G`, denoted by $G_M$,
is the graph obtained from G by directing the edges of M from V to U and the
edges that do not belong to M from U to V.

Lemma [1]_ :
Let M be a perfect matching of `G`. `G` is $k$-extendable if and only if its residual
graph $G_M$ is strongly connected and there are $k$ vertex-disjoint directed
paths between every vertex of U and every vertex of V.

Assuming that input graph `G` is undirected, simple, connected, bipartite and contains
a perfect matching M, this function constructs the residual graph $G_M$ of G and
returns the minimum value among the maximum vertex-disjoint directed paths between
every vertex of U and every vertex of V in $G_M$. By combining the definitions
and the lemma, this value represents the extendability of the graph `G`.

Time complexity O($n^3$ $m^2$)) where $n$ is the number of vertices
and $m$ is the number of edges.

References
----------
.. [1] "A polynomial algorithm for the extendability problem in bipartite graphs",
      J. Lakhal, L. Litzler, Information Processing Letters, 1998.
.. [2] "On n-extendible graphs", M. D. Plummer, Discrete Mathematics, 31:201â€“210, 1980
      https://doi.org/10.1016/0012-365X(80)90037-0

zGraph G is not connectedzGraph G is not bipartitez+Graph G does not contain a perfect matchingz1The residual graph of G is not strongly connectedÚinfc              3   ó&   "  € T F  p^x € K	  	  R# 5i)é   N© )Ú.0Ú_s   & Úl/home/luca/screen-checking/.venv/lib/python3.14/site-packages/networkx/algorithms/bipartite/extendability.pyÚ	<genexpr>Ú(maximal_extendability.<locals>.<genexpr>g   s   é € ÐPÑ'O !�AÓ'Oùs   ‚)ÚnxÚis_connectedÚNetworkXErrorÚ	bipartiteÚis_bipartiteÚsetsÚhopcroft_karp_matchingÚis_perfect_matchingÚkeysÚedgesÚDiGraphÚadd_nodes_fromÚadd_edges_fromÚis_strongly_connectedÚfloatÚsumÚnode_disjoint_paths)ÚGÚUÚVÚmaximum_matchingÚnodeÚpmÚxÚyÚdirected_edgesÚ
residual_GÚkÚuÚvÚ	num_pathss   &             r   r   r   
   s·  € ôt �?Š?˜1×ÒÜ×ÒÐ9Ó:Ð:ä�<‰<×$Ñ$ Q×'Ò'Ü×ÒÐ9Ó:Ð:ä�<‰<×Ñ˜QÓ�D€Aä—|‘|×:Ñ:¸1Ó=Ðä×!Ò! !×6Ò6Ü×ÒÐLÓMÐMð 67×9NÑ9NÓ9PÖ5PÓ	QÑ5P¨TÐ!Õ'Ó
(Ñ5P€BÐ	Qð
 —G’Gôá‰DˆAð ”6˜q˜f¨œl°´¸A¸6ÈÔ;Kˆ‰ÐSTÐRXÒXÙð ñ ô —’“€JØ×Ñ˜aÔ Ø×Ñ˜nÔ-ä×#Ò# J×/Ò/Ü×ÒÐRÓSÐSô 	ˆe‹€AÛˆÛˆAÜÑP¤r×'=Ò'=¸jÈQÔ'OÓPÓPˆIØ”]‘¨	ŠAó ñ ð €Hùò/ 
Rùós   Ã8HÄ-H	)Ú__doc__Únetworkxr   Únetworkx.utilsr   Ú__all__Ú_dispatchabler   r
   ó    r   Ú<module>r5      sQ   ðñ[ó Ý .à"Ð
#€ñ �ZÓ Ù�\Ó"Ø×Ññ\ó ó #ó !ò\r4   