ó žÃÒYc@sdZddlZddlmZddddgZedƒd „ƒZedƒd „ƒZedƒd „ƒZedƒe d „ƒZ dS( sAttracting components.iÿÿÿÿN(tnot_implemented_fortnumber_attracting_componentstattracting_componentstis_attracting_componenttattracting_component_subgraphst undirectedccs]ttj|ƒƒ}tj||ƒ}x/|D]'}|j|ƒdkr.||Vq.q.WdS(s“Generates a list of attracting components in `G`. An attracting component in a directed graph `G` is a strongly connected component with the property that a random walker on the graph will never leave the component, once it enters the component. The nodes in attracting components can also be thought of as recurrent nodes. If a random walker enters the attractor containing the node, then the node will be visited infinitely often. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- attractors : generator of sets A generator of sets of nodes, one for each attracting component of G. Raises ------ NetworkXNotImplemented : If the input graph is undirected. See Also -------- number_attracting_components is_attracting_component attracting_component_subgraphs iN(tlisttnxtstrongly_connected_componentst condensationt out_degree(tGtscctcGtn((s/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/components/attracting.pyRs " cCsttt|ƒƒƒ}|S(sÁReturns the number of attracting components in `G`. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- n : int The number of attracting components in G. Raises ------ NetworkXNotImplemented : If the input graph is undirected. See Also -------- attracting_components is_attracting_component attracting_component_subgraphs (tlenRR(R R((s/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/components/attracting.pyR>scCsAtt|ƒƒ}t|dƒt|ƒkr7t}nt}|S(sòReturns True if `G` consists of a single attracting component. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- attracting : bool True if `G` has a single attracting component. Otherwise, False. Raises ------ NetworkXNotImplemented : If the input graph is undirected. See Also -------- attracting_components number_attracting_components attracting_component_subgraphs i(RRRtTruetFalse(R tact attracting((s/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/components/attracting.pyR\s  ccsFx?t|ƒD]1}|r0|j|ƒjƒVq |j|ƒVq WdS(s]Generates a list of attracting component subgraphs from `G`. Parameters ---------- G : DiGraph, MultiDiGraph The graph to be analyzed. Returns ------- subgraphs : list A list of node-induced subgraphs of the attracting components of `G`. copy : bool If copy is True, graph, node, and edge attributes are copied to the subgraphs. Raises ------ NetworkXNotImplemented : If the input graph is undirected. See Also -------- attracting_components number_attracting_components is_attracting_component N(Rtsubgraphtcopy(R RR((s/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/components/attracting.pyR~s( t__doc__tnetworkxRtnetworkx.utils.decoratorsRt__all__RRRRR(((s/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/components/attracting.pyt s  )"