Ë
    D^(hm
  ã                   óz   — d Z ddlmZ ddlZddlmZ ddgZej                  d	d„«       Z	ej                  d„ «       Z
y)
z3Functions for computing dominating sets in a graph.é    )ÚchainN)Úarbitrary_elementÚdominating_setÚis_dominating_setc                 ó$  — t        | «      }|€t        |«      }|| vrt        j                  d|› d�«      ‚|h}t        | |   «      }||z
  |z
  }|r?|j	                  «       }t        | |   «      |z
  }|j                  |«       ||z  }||z  }|rŒ?|S )a\  Finds a dominating set for the graph G.

    A *dominating set* for a graph with node set *V* is a subset *D* of
    *V* such that every node not in *D* is adjacent to at least one
    member of *D* [1]_.

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

    start_with : node (default=None)
        Node to use as a starting point for the algorithm.

    Returns
    -------
    D : set
        A dominating set for G.

    Notes
    -----
    This function is an implementation of algorithm 7 in [2]_ which
    finds some dominating set, not necessarily the smallest one.

    See also
    --------
    is_dominating_set

    References
    ----------
    .. [1] https://en.wikipedia.org/wiki/Dominating_set

    .. [2] Abdol-Hossein Esfahanian. Connectivity Algorithms.
        http://www.cse.msu.edu/~cse835/Papers/Graph_connectivity_revised.pdf

    znode z is not in G)Úsetr   ÚnxÚNetworkXErrorÚpopÚadd)ÚGÚ
start_withÚ	all_nodesr   Údominated_nodesÚremaining_nodesÚvÚundominated_nbrss           ú\/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/networkx/algorithms/dominating.pyr   r      s»   € ôJ �A“€IØÐÜ& yÓ1ˆ
Ø˜ÑÜ×Ñ  z l°,Ð?Ó@Ð@Ø �\€NÜ˜!˜J™-Ó(€OØ /Ñ1°NÑB€OÙ
à×ÑÓ!ˆÜ˜q ™t›9 ~Ñ5Ðð 	×Ñ˜1ÔØÐ+Ñ+ˆØÐ+Ñ+ˆò ð Ðó    c                 ó¾   ‡ — |D �ch c]	  }|‰ v sŒ|’Œ }}t        t        j                  ˆ fd„|D «       «      «      }t        t        ‰ «      |z
  |z
  «      dk(  S c c}w )aÛ  Checks if `nbunch` is a dominating set for `G`.

    A *dominating set* for a graph with node set *V* is a subset *D* of
    *V* such that every node not in *D* is adjacent to at least one
    member of *D* [1]_.

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

    nbunch : iterable
        An iterable of nodes in the graph `G`.

    See also
    --------
    dominating_set

    References
    ----------
    .. [1] https://en.wikipedia.org/wiki/Dominating_set

    c              3   ó(   •K  — | ]	  }‰|   –— Œ y ­w©N© )Ú.0Únr   s     €r   ú	<genexpr>z$is_dominating_set.<locals>.<genexpr>^   s   øè ø€ Ò"9¨A 1 Q¥4Ñ"9ùs   ƒr   )r   r   Úfrom_iterableÚlen)r   Únbunchr   ÚtestsetÚnbrss   `    r   r   r   E   s\   ø€ ð0 !Ö+�Q A¨¢FŠqÐ+€GÐ+ÜŒu×"Ñ"Ó"9°Ô"9Ó9Ó:€DÜŒs�1‹v˜Ñ $Ñ&Ó'¨1Ñ,Ð,ùò ,s
   †	A�Ar   )Ú__doc__Ú	itertoolsr   Únetworkxr	   Únetworkx.utilsr   Ú__all__Ú_dispatchabler   r   r   r   r   ú<module>r(      sQ   ðÙ 9å ã Ý ,àÐ0Ð
1€ð ×Ñò6ó ð6ðr ×Ññ-ó ñ-r   