Ë
    D^(hëq  ã                   ó$  — d Z ddlZddlZddlmZ ddlZddlmZ ddgZ	 G d„ d«      Z
 G d	„ d
e
«      Z G d„ de«      Z G d„ de«      Z G d„ de
«      Z G d„ de«      Z G d„ de«      Z	 	 	 	 	 dd„Z edd«      	 	 	 	 	 	 	 dd„«       Zd„ Zd„ Zy)z-
Text-based visual representations of graphs
é    N)Údefaultdict)Ú	open_fileÚgenerate_network_textÚwrite_network_textc                   ó   — e Zd Zed„ «       Zy)Ú
BaseGlyphsc                 ó€   — t        | «      D �ci c]%  }|j                  d«      s|dk7  r|t        | |«      “Œ' c}S c c}w )NÚ_Úas_dict)ÚdirÚ
startswithÚgetattr)ÚclsÚas     úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/networkx/readwrite/text.pyr   zBaseGlyphs.as_dict   sE   € ô ˜“Xö
àØ—<‘< Ô$¨¨iªð Œw�s˜A‹Ñò
ð 	
ùò 
s   Ž*;N)Ú__name__Ú
__module__Ú__qualname__Úclassmethodr   © ó    r   r   r      s   „ Øñ
ó ñ
r   r   c                   ób   — e Zd ZU dZeed<   dZeed<   dZeed<   dZeed<   dZ	eed	<   d
Z
eed<   y)ÚAsciiBaseGlyphsú+Úemptyz+-- Únewtree_lastÚnewtree_midú    Úendof_forestz:   Úwithin_forestz|   Úwithin_treeN©r   r   r   r   ÚstrÚ__annotations__r   r   r   r    r!   r   r   r   r   r      s>   … Ø€Eˆ3ÓØ€L�#ÓØ€K�ÓØ€L�#ÓØ€M�3ÓØ€K�Ôr   r   c                   óF   — e Zd ZU dZeed<   dZeed<   dZeed<   dZeed<   y	)
ÚAsciiDirectedGlyphszL-> Úlastz|-> Úmidz<-Úbackedgeú!Úvertical_edgeN©	r   r   r   r'   r#   r$   r(   r)   r+   r   r   r   r&   r&   "   s*   … Ø€Dˆ#ÓØ€CˆÓØ€HˆcÓØ€M�3Ôr   r&   c                   óF   — e Zd ZU dZeed<   dZeed<   dZeed<   dZeed<   y	)
ÚAsciiUndirectedGlyphszL-- r'   z|-- r(   ú-r)   ú|r+   Nr,   r   r   r   r.   r.   )   s*   … Ø€Dˆ#ÓØ€CˆÓØ€HˆcÓØ€M�3Ôr   r.   c                   ób   — e Zd ZU dZeed<   dZeed<   dZeed<   dZeed<   d	Z	eed
<   dZ
eed<   y)ÚUtfBaseGlyphsu   â•™r   u
   â•™â”€â”€ r   u
   â•Ÿâ”€â”€ r   r   r   u   â•Ž   r    u   â”‚   r!   Nr"   r   r   r   r2   r2   0   s@   … ð €Eˆ3ÓØ$€L�#Ó$Ø#€K�Ó#Ø€L�#ÓØ!€M�3Ó!Ø€K�Ôr   r2   c                   óF   — e Zd ZU dZeed<   dZeed<   dZeed<   dZeed<   y	)
ÚUtfDirectedGlyphsu
   â””â”€â•¼ r'   u
   â”œâ”€â•¼ r(   u   â•¾r)   u   â•½r+   Nr,   r   r   r   r4   r4   <   ó*   … Ø€Dˆ#ÓØ€CˆÓØ€HˆcÓØ€M�3Ôr   r4   c                   óF   — e Zd ZU dZeed<   dZeed<   dZeed<   dZeed<   y	)
ÚUtfUndirectedGlyphsu
   â””â”€â”€ r'   u
   â”œâ”€â”€ r(   u   â”€r)   u   â”‚r+   Nr,   r   r   r   r7   r7   C   r5   r   r7   c              #   ó:	  ‡(K  — ddl mŠ(m}  G ˆ(fd„d|«      }d}| j                  «       }	|	r'|rt        nt
        }
| j                  }| j                  }n&|rt        nt        }
| j                  }| j                  }t        |t        «      r|}n|rd}nd}|dk(  r|
j                  dz   –— yt        | j                  «      dk(  r|
j                  –— y|€t!        | «      }t        |«      d	z
  }t#        |«      D ��cg c]  \  }} |d|g ||k(  d
«      ‘Œ c}}ddd…   }t%        d„ «      }t'        «       }|�rI|j)                  «       \  }}}}}|t*        urs||v }|r||xx   d	z  cc<   |rJ||   rE|�Cd} ||t*        ||d
«      }|j-                  |«       d
} ||||||«      }|j-                  |«       Œ€|rŒƒ|j/                  |«       |sF|r#d
}||
j0                  gz   }||
j2                  gz   }nk||
j4                  gz   }||
j6                  gz   }nJ|r|}|}nC|r!||
j8                  gz   }||
j2                  gz   }n ||
j:                  gz   }||
j<                  gz   }|t*        u rd}d}g }�nb|�)t        | j                  |   j?                  ||«      «      }nt        |«      }|� | j                  |   j?                  |d
«      } nd
} |	rtA        ||   «      }|h}!n||   D �"cg c]	  }"|"|vsŒ|"‘Œ }}"h |£|’}!|�t        |«      |d	z
  k(  r|rt*        g}|h}!| r|rt*        g}|h}!||   D �#cg c]	  }#|#|!vsŒ|#‘Œ }$}#|$r�|�FdjC                  |$D �#cg c]*  }#t        | j                  |#   j?                  ||#«      «      ‘Œ, c}#«      }%n(djC                  |$D �#cg c]  }#t        |#«      ‘Œ c}#«      }%djC                  d|
jD                  |%g«      }nd}|r!djC                  ||
jF                  gz   «      –— djC                  |||gz   «      –— |r5|	rt        t'        |«      «      }&nt        t'        |«      |hz
  «      }&|&d	k(  }'nd
}'t#        |ddd…   «      D ]'  \  }}"|dk(  } |||"|||'«      }|j-                  |«       Œ) |r�ŒHyyc c}}w c c}"w c c}#w c c}#w c c}#w ­w)ul  Generate lines in the "network text" format

    This works via a depth-first traversal of the graph and writing a line for
    each unique node encountered. Non-tree edges are written to the right of
    each node, and connection to a non-tree edge is indicated with an ellipsis.
    This representation works best when the input graph is a forest, but any
    graph can be represented.

    This notation is original to networkx, although it is simple enough that it
    may be known in existing literature. See #5602 for details. The procedure
    is summarized as follows:

    1. Given a set of source nodes (which can be specified, or automatically
    discovered via finding the (strongly) connected components and choosing one
    node with minimum degree from each), we traverse the graph in depth first
    order.

    2. Each reachable node will be printed exactly once on it's own line.

    3. Edges are indicated in one of four ways:

        a. a parent "L-style" connection on the upper left. This corresponds to
        a traversal in the directed DFS tree.

        b. a backref "<-style" connection shown directly on the right. For
        directed graphs, these are drawn for any incoming edges to a node that
        is not a parent edge. For undirected graphs, these are drawn for only
        the non-parent edges that have already been represented (The edges that
        have not been represented will be handled in the recursive case).

        c. a child "L-style" connection on the lower right. Drawing of the
        children are handled recursively.

        d. if ``vertical_chains`` is true, and a parent node only has one child
        a "vertical-style" edge is drawn between them.

    4. The children of each node (wrt the directed DFS tree) are drawn
    underneath and to the right of it. In the case that a child node has already
    been drawn the connection is replaced with an ellipsis ("...") to indicate
    that there is one or more connections represented elsewhere.

    5. If a maximum depth is specified, an edge to nodes past this maximum
    depth will be represented by an ellipsis.

    6. If a node has a truthy "collapse" value, then we do not traverse past
    that node.

    Parameters
    ----------
    graph : nx.DiGraph | nx.Graph
        Graph to represent

    with_labels : bool | str
        If True will use the "label" attribute of a node to display if it
        exists otherwise it will use the node value itself. If given as a
        string, then that attribute name will be used instead of "label".
        Defaults to True.

    sources : List
        Specifies which nodes to start traversal from. Note: nodes that are not
        reachable from one of these sources may not be shown. If unspecified,
        the minimal set of nodes needed to reach all others will be used.

    max_depth : int | None
        The maximum depth to traverse before stopping. Defaults to None.

    ascii_only : Boolean
        If True only ASCII characters are used to construct the visualization

    vertical_chains : Boolean
        If True, chains of nodes will be drawn vertically when possible.

    Yields
    ------
    str : a line of generated text

    Examples
    --------
    >>> graph = nx.path_graph(10)
    >>> graph.add_node("A")
    >>> graph.add_node("B")
    >>> graph.add_node("C")
    >>> graph.add_node("D")
    >>> graph.add_edge(9, "A")
    >>> graph.add_edge(9, "B")
    >>> graph.add_edge(9, "C")
    >>> graph.add_edge("C", "D")
    >>> graph.add_edge("C", "E")
    >>> graph.add_edge("C", "F")
    >>> nx.write_network_text(graph)
    â•™â”€â”€ 0
        â””â”€â”€ 1
            â””â”€â”€ 2
                â””â”€â”€ 3
                    â””â”€â”€ 4
                        â””â”€â”€ 5
                            â””â”€â”€ 6
                                â””â”€â”€ 7
                                    â””â”€â”€ 8
                                        â””â”€â”€ 9
                                            â”œâ”€â”€ A
                                            â”œâ”€â”€ B
                                            â””â”€â”€ C
                                                â”œâ”€â”€ D
                                                â”œâ”€â”€ E
                                                â””â”€â”€ F
    >>> nx.write_network_text(graph, vertical_chains=True)
    â•™â”€â”€ 0
        â”‚
        1
        â”‚
        2
        â”‚
        3
        â”‚
        4
        â”‚
        5
        â”‚
        6
        â”‚
        7
        â”‚
        8
        â”‚
        9
        â”œâ”€â”€ A
        â”œâ”€â”€ B
        â””â”€â”€ C
            â”œâ”€â”€ D
            â”œâ”€â”€ E
            â””â”€â”€ F
    r   )ÚAnyÚ
NamedTuplec                   óF   •— e Zd ZU W ° ed<   W ° ed<   eed<   eed<   eed<   y)ú)generate_network_text.<locals>.StackFrameÚparentÚnodeÚindentsÚthis_islastÚthis_verticalN)r   r   r   r$   ÚlistÚbool©r9   s   €r   Ú
StackFramer<   Ù   s   ø… Ù‹Ù‹	Ø‹ØÓØÔr   rE   ÚcollapseÚlabelNz ...é   Féÿÿÿÿc                   ó   — y)Nr   r   r   r   r   ú<lambda>z'generate_network_text.<locals>.<lambda>
  s   � r   TÚ ú, ú )$Útypingr9   r:   Úis_directedr&   r4   ÚsuccÚpredr.   r7   ÚadjÚ
isinstancer#   r   ÚlenÚnodesÚ_find_sourcesÚ	enumerater   ÚsetÚpopÚEllipsisÚappendÚaddr   r   r   r    r'   r(   r!   ÚgetrB   Újoinr)   r+   ))ÚgraphÚwith_labelsÚsourcesÚ	max_depthÚ
ascii_onlyÚvertical_chainsr:   rE   Úcollapse_attrrP   ÚglyphsrQ   rR   Ú
label_attrÚlast_idxÚidxr>   ÚstackÚnum_skipped_childrenÚ
seen_nodesr=   r?   r@   rA   ÚskipÚnext_islastÚ	try_frameÚthis_prefixÚnext_prefixrG   ÚsuffixÚchildrenrF   Úhandled_parentsÚchildÚpÚother_parentsÚother_parents_labelsÚnum_childrenÚnext_is_verticalr9   s)                                           @r   r   r   J   s)  øè ø€ ÷Z 'ö�Zô ð €Mà×#Ñ#Ó%€KáÙ(2Õ$Ô8IˆØ�z‰zˆØ�z‰z‰á*4Õ&Ô:MˆØ�y‰yˆØ�y‰yˆä�+œsÔ#Ø ‰
Ù	Ø‰
àˆ
à�A‚~Ø�l‰l˜VÑ#Ó#Ü	ˆU�[‰[Ó	˜QÒ	Ø�l‰lÓð ˆ?Ü# EÓ*ˆGô �w“< !Ñ#ˆô ' wÓ/÷
á��Tñ �t˜T 2¨¨x©¸%Õ@ó
ñ ˆBˆ$ñˆô
  +©9Ó5ÐÜ“Uˆ
ÚØ@EÇ	Á	ÃÑ=ˆF�D˜' ;°àœ8Ñ#Ø˜zÐ)�Ùà(¨Ó0°AÑ5Ó0áð ,¨FÒ3¸Ð8Jà&*˜Ù$.Ø ¤(¨G°[À%ó%˜	ð Ÿ™ YÔ/ð ',˜Ù$.Ø" D¨'°;Àó%˜	ð Ÿ™ YÔ/Ø áØØ—‘˜tÔ$áñ Ø$)�MØ")¨V×-@Ñ-@Ð,AÑ"A�KØ")¨V×-@Ñ-@Ð,AÑ"A‘Kà")¨V×-?Ñ-?Ð,@Ñ"@�KØ")¨V×-AÑ-AÐ,BÑ"B‘Kñ !Ø")�KØ")‘Ká"Ø&-°·±°Ñ&=˜Ø&-°×1DÑ1DÐ0EÑ&E™à&-°·±°Ñ&<˜Ø&-°×1CÑ1CÐ0DÑ&D˜à”xÑØ�Ø�Ø’àÐ)Ü §¡¨DÑ 1× 5Ñ 5°jÀ$Ó GÓH‘Eä ›I�Eð !Ð,Ø$Ÿ{™{¨4Ñ0×4Ñ4°]ÀEÓJ‘Hà$�Hñ
 ô  $ D¨¡JÓ/�Hð (. h‘Oð
 ,0°©:ö Ø"'¸ÀjÒ9Pšð �Hð  ð ':¨Ð&9°&Ð&9�OàÐ(¬S°«\¸YÈ¹]Ò-JáÜ$, :˜Ø'- h�OááÜ$, :˜Ø'- h�Oð -1°©JÖ S q¸!À?Ò:R¢Ð S�Ð SÙ Ø!Ð-Ø/3¯y©yð *7öà$%ô !$ E§K¡K°¡N×$6Ñ$6°zÀ1Ó$EÕ Fòó0Ñ,ð 04¯y©yØ-:Ö;¨œS �VÒ;ó0Ð,ð !ŸX™X r¨6¯?©?Ð<PÐ&QÓR‘Fà�Fñ Ø—g‘g˜k¨V×-AÑ-AÐ,BÑBÓCÒCà—'‘'˜+¨°¨Ñ7Ó8Ò8áÙÜ#&¤s¨8£}Ó#5‘Lä#&¤s¨8£}¸°xÑ'?Ó#@�Lð $0°1Ñ#4Ñ à#(Ð ô (¨±°2°©Ó7ò (‘
��UØ! Q™h�Ù&Ø˜% ¨kÐ;Kó�	ð —‘˜YÕ'ð(õg ùó
ùò| ùò. !Tùòùò <ùsV   ƒC8RÃ;RÄGRË	RË)RË-<RÌ)	RÌ3RÌ7RÍ/RÍ;RÎRÎ$CRÑ?RrH   Úwc                 óö   — |€t         j                  j                  }n;t        |d«      r|j                  }n"t	        |«      r|}nt        t        |«      «      ‚t        | |||||¬«      D ]  }	 ||	|z   «       Œ y)u¾  Creates a nice text representation of a graph

    This works via a depth-first traversal of the graph and writing a line for
    each unique node encountered. Non-tree edges are written to the right of
    each node, and connection to a non-tree edge is indicated with an ellipsis.
    This representation works best when the input graph is a forest, but any
    graph can be represented.

    Parameters
    ----------
    graph : nx.DiGraph | nx.Graph
        Graph to represent

    path : string or file or callable or None
       Filename or file handle for data output.
       if a function, then it will be called for each generated line.
       if None, this will default to "sys.stdout.write"

    with_labels : bool | str
        If True will use the "label" attribute of a node to display if it
        exists otherwise it will use the node value itself. If given as a
        string, then that attribute name will be used instead of "label".
        Defaults to True.

    sources : List
        Specifies which nodes to start traversal from. Note: nodes that are not
        reachable from one of these sources may not be shown. If unspecified,
        the minimal set of nodes needed to reach all others will be used.

    max_depth : int | None
        The maximum depth to traverse before stopping. Defaults to None.

    ascii_only : Boolean
        If True only ASCII characters are used to construct the visualization

    end : string
        The line ending character

    vertical_chains : Boolean
        If True, chains of nodes will be drawn vertically when possible.

    Examples
    --------
    >>> graph = nx.balanced_tree(r=2, h=2, create_using=nx.DiGraph)
    >>> nx.write_network_text(graph)
    â•™â”€â”€ 0
        â”œâ”€â•¼ 1
        â”‚   â”œâ”€â•¼ 3
        â”‚   â””â”€â•¼ 4
        â””â”€â•¼ 2
            â”œâ”€â•¼ 5
            â””â”€â•¼ 6

    >>> # A near tree with one non-tree edge
    >>> graph.add_edge(5, 1)
    >>> nx.write_network_text(graph)
    â•™â”€â”€ 0
        â”œâ”€â•¼ 1 â•¾ 5
        â”‚   â”œâ”€â•¼ 3
        â”‚   â””â”€â•¼ 4
        â””â”€â•¼ 2
            â”œâ”€â•¼ 5
            â”‚   â””â”€â•¼  ...
            â””â”€â•¼ 6

    >>> graph = nx.cycle_graph(5)
    >>> nx.write_network_text(graph)
    â•™â”€â”€ 0
        â”œâ”€â”€ 1
        â”‚   â””â”€â”€ 2
        â”‚       â””â”€â”€ 3
        â”‚           â””â”€â”€ 4 â”€ 0
        â””â”€â”€  ...

    >>> graph = nx.cycle_graph(5, nx.DiGraph)
    >>> nx.write_network_text(graph, vertical_chains=True)
    â•™â”€â”€ 0 â•¾ 4
        â•½
        1
        â•½
        2
        â•½
        3
        â•½
        4
        â””â”€â•¼  ...

    >>> nx.write_network_text(graph, vertical_chains=True, ascii_only=True)
    +-- 0 <- 4
        !
        1
        !
        2
        !
        3
        !
        4
        L->  ...

    >>> graph = nx.generators.barbell_graph(4, 2)
    >>> nx.write_network_text(graph, vertical_chains=False)
    â•™â”€â”€ 4
        â”œâ”€â”€ 5
        â”‚   â””â”€â”€ 6
        â”‚       â”œâ”€â”€ 7
        â”‚       â”‚   â”œâ”€â”€ 8 â”€ 6
        â”‚       â”‚   â”‚   â””â”€â”€ 9 â”€ 6, 7
        â”‚       â”‚   â””â”€â”€  ...
        â”‚       â””â”€â”€  ...
        â””â”€â”€ 3
            â”œâ”€â”€ 0
            â”‚   â”œâ”€â”€ 1 â”€ 3
            â”‚   â”‚   â””â”€â”€ 2 â”€ 0, 3
            â”‚   â””â”€â”€  ...
            â””â”€â”€  ...
    >>> nx.write_network_text(graph, vertical_chains=True)
    â•™â”€â”€ 4
        â”œâ”€â”€ 5
        â”‚   â”‚
        â”‚   6
        â”‚   â”œâ”€â”€ 7
        â”‚   â”‚   â”œâ”€â”€ 8 â”€ 6
        â”‚   â”‚   â”‚   â”‚
        â”‚   â”‚   â”‚   9 â”€ 6, 7
        â”‚   â”‚   â””â”€â”€  ...
        â”‚   â””â”€â”€  ...
        â””â”€â”€ 3
            â”œâ”€â”€ 0
            â”‚   â”œâ”€â”€ 1 â”€ 3
            â”‚   â”‚   â”‚
            â”‚   â”‚   2 â”€ 0, 3
            â”‚   â””â”€â”€  ...
            â””â”€â”€  ...

    >>> graph = nx.complete_graph(5, create_using=nx.Graph)
    >>> nx.write_network_text(graph)
    â•™â”€â”€ 0
        â”œâ”€â”€ 1
        â”‚   â”œâ”€â”€ 2 â”€ 0
        â”‚   â”‚   â”œâ”€â”€ 3 â”€ 0, 1
        â”‚   â”‚   â”‚   â””â”€â”€ 4 â”€ 0, 1, 2
        â”‚   â”‚   â””â”€â”€  ...
        â”‚   â””â”€â”€  ...
        â””â”€â”€  ...

    >>> graph = nx.complete_graph(3, create_using=nx.DiGraph)
    >>> nx.write_network_text(graph)
    â•™â”€â”€ 0 â•¾ 1, 2
        â”œâ”€â•¼ 1 â•¾ 2
        â”‚   â”œâ”€â•¼ 2 â•¾ 0
        â”‚   â”‚   â””â”€â•¼  ...
        â”‚   â””â”€â•¼  ...
        â””â”€â•¼  ...
    NÚwrite)ra   rb   rc   rd   re   )ÚsysÚstdoutr~   ÚhasattrÚcallableÚ	TypeErrorÚtyper   )
r`   Úpathra   rb   rc   rd   Úendre   Ú_writeÚlines
             r   r   r   §  s{   € ðJ €|ä—‘×!Ñ!‰Ü	��wÔ	à—‘‰Ü	�$Œà‰äœ˜T›
Ó#Ð#ä%ØØØØØØ'ôò ˆñ 	ˆt�c‰zÕñr   c                 óv  ‡ — ‰ j                  «       rÝt        t        j                  ‰ «      «      }t        j                  ‰ |«      }|j                  «       D �ci c]  }|g “Œ }}|j                  d   }‰ j
                  D ]  }||   }||   j                  |«       Œ g }|j                  «       D ];  }|j                  |   dk(  sŒ||   }t        |ˆ fd„¬«      }	|j                  |	«       Œ= |S t        j                  ‰ «      D �
cg c]  }
t        |
ˆ fd„¬«      ‘Œ }}
t        |ˆ fd„¬«      }|S c c}w c c}
w )zR
    Determine a minimal set of nodes such that the entire graph is reachable
    Úmappingr   c                 ó"   •— ‰j                   |    S ©N)Ú	in_degree©Únr`   s    €r   rK   z_find_sources.<locals>.<lambda>{  s   ø€ ¨e¯o©o¸aÑ.@€ r   )Úkeyc                 ó"   •— ‰j                   |    S rŒ   ©ÚdegreerŽ   s    €r   rK   z_find_sources.<locals>.<lambda>�  s   ø€  %§,¡,¨q¡/€ r   c                 ó"   •— ‰j                   |    S rŒ   r’   rŽ   s    €r   rK   z_find_sources.<locals>.<lambda>„  s   ø€ °·±¸Q±€ r   )rP   rB   ÚnxÚstrongly_connected_componentsÚcondensationrV   r`   r\   r�   ÚminÚconnected_componentsÚsorted)r`   ÚsccsÚ	scc_graphÚsnÚsupernode_to_nodesrŠ   r�   rb   Úsccr>   Úccs   `          r   rW   rW   c  sA  ø€ ð ×ÑÔä”B×4Ñ4°UÓ;Ó<ˆô —O‘O E¨4Ó0ˆ	Ø/8¯©Ó/@ÖA¨˜b "™fÐAÐÐAð —/‘/ )Ñ,ˆØ—‘ò 	-ˆAØ˜‘ˆBØ˜rÑ"×)Ñ)¨!Õ,ð	-ð ˆØ—/‘/Ó#ò 	%ˆBØ×"Ñ" 2Ñ&¨!Ó+Ø(¨Ñ,�Ü˜3Ó$@ÔA�Ø—‘˜tÕ$ð		%ð €Nô ×-Ñ-¨eÓ4ö
àô �Ó1Ö2ð
ˆð 
ô ˜Ó&?Ô@ˆØ€Nùò+ Bùò 
s   Á
D1ÄD6c                 ó¢	  ‡)‡*— ddl m} ddlmŠ)m}m}  G ˆ)fd„d|«      }t        | «      }d}d}g }	 t        |«      }	|j                  |	«       |	d   }
|
t        j                  t        j                  d   t        j                  d   hv rd}nH|
t        j                  t        j                  d   t        j                  d   hv rd}nt        d	|
› �«      ‚|r)t         j#                  «       }t$        j#                  «       }n(t&        j#                  «       }t(        j#                  «       }t+        |j-                  «       «      }t+        |j-                  «       «      }g }|D ],  }|}|D �cg c]	  }||v sŒ|‘Œ }}|rŒ|j                  |«       Œ. g }|D ],  }|}|D �cg c]	  }||v sŒ|‘Œ }}|rŒ|j                  |«       Œ. |D ]C  Š*|j                  ‰*«       t/        ˆ*fd
„|D «       «      rd} nt/        ˆ*fd„|D «       «      sŒAd} n |€d}|r|n|}d|d   z   dz   } |||«      }g }g }d}t1        «       } ||dd«      g}|D �]  Š*‰*|d   k(  rd}Œ|‰*v r—‰*j3                  |«      \  }}|j3                  d«      D �cg c]  }|j5                  «       ‘Œ } }|j7                  «       }|j9                  dd«      \  }!}"|"j5                  «       }"|j;                  | D �cg c]  }||"f‘Œ c}«       n%‰*j9                  dd«      \  }!}"|"j5                  «       }"|j=                  «       }#|"|d   v r1 ||#j>                  |#j@                  d«      }$|j                  |$«       �ŒtC        |!«      }% ||"|%d«      }&|#jD                  rnC|&j@                  |#j@                  k  r*|j=                  «       }#|&j@                  |#j@                  k  rŒ*|"dk(  r|j                  |#«       �Œ”|j                  |#«       |j                  |&«       |j                  |&j>                  «       |#j>                  |us�Œá|j                  |#j>                  |&j>                  f«       �Œ
 |rtC        |«      dk(  sJ ‚|rtF        jH                  ntF        jJ                  }' |'«       }(|(jM                  |«       |(jO                  |«       |(S # t        $ r Y �Œäw xY wc c}w c c}w c c}w c c}w )a•  Reconstructs a graph from a network text representation.

    This is mainly used for testing.  Network text is for display, not
    serialization, as such this cannot parse all network text representations
    because node labels can be ambiguous with the glyphs and indentation used
    to represent edge structure. Additionally, there is no way to determine if
    disconnected graphs were originally directed or undirected.

    Parameters
    ----------
    lines : list or iterator of strings
        Input data in network text format

    Returns
    -------
    G: NetworkX graph
        The graph corresponding to the lines in network text format.
    r   )Úchain)r9   r:   ÚUnionc                   ó6   •— e Zd ZU W ° ed<   eed<   edz  ed<   y)ú,_parse_network_text.<locals>.ParseStackFramer>   ÚindentNÚhas_vertical_child)r   r   r   r$   ÚintrD   s   €r   ÚParseStackFramer¥   ž  s   ø… Ù‹	Ø‹Ø $™JÔ&r   r©   NFTzUnexpected first character: c              3   ó&   •K  — | ]  }|‰v –— Œ
 y ­wrŒ   r   ©Ú.0Úitemrˆ   s     €r   ú	<genexpr>z&_parse_network_text.<locals>.<genexpr>ã  s   øè ø€ ÒE ˆt�tŒ|ÑEùó   ƒc              3   ó&   •K  — | ]  }|‰v –— Œ
 y ­wrŒ   r   r«   s     €r   r®   z&_parse_network_text.<locals>.<genexpr>æ  s   øè ø€ ÒE $�˜”ÑEùr¯   rN   r)   rI   r   rM   rH   r+   z...)(Ú	itertoolsr¢   rO   r9   r:   r£   ÚiterÚnextr\   r2   r   r   r   r   ÚAssertionErrorÚStopIterationr&   r   r.   r4   r7   rY   ÚvaluesÚanyÚobjectÚsplitÚstripÚrstripÚrsplitÚextendrZ   r>   r¦   rU   r§   r•   ÚDiGraphÚGraphÚadd_nodes_fromÚadd_edges_from)+Úlinesr¢   r:   r£   r©   Úinitial_line_iterÚis_asciirP   Úinitial_linesÚ
first_lineÚ
first_charÚdirected_glyphsÚundirected_glyphsÚdirected_itemsÚundirected_itemsÚunambiguous_directed_itemsr­   Úother_itemsÚotherÚother_supersetsÚunambiguous_undirected_itemsrg   Úbackedge_symbolÚparsing_line_iterÚedgesrV   Úis_emptyÚnoparentrk   Ú	node_partÚbackedge_partÚuÚbackedge_nodesÚprefixr>   ÚprevÚmodified_prevr¦   Úcurrr   Únewr9   rˆ   s+                                            @@r   Ú_parse_network_textrß   ˆ  sà  ù€ õ&  ß-Ñ-ö'˜*ô 'ô
 ˜U›Ðà€HØ€Kð €MðNÜÐ+Ó,ˆ
ð 	×Ñ˜ZÔ(à ‘]ˆ
ØÜ×ÑÜ×%Ñ% aÑ(Ü×&Ñ& qÑ)ð
ñ 
ð
 ‰HØÜ×!Ñ!Ü×'Ñ'¨Ñ*Ü×(Ñ(¨Ñ+ð
ñ 
ð
 ‰Hä Ð#?À
¸|Ð!LÓMÐMáÜ-×5Ñ5Ó7ˆÜ1×9Ñ9Ó;Ñä+×3Ñ3Ó5ˆÜ/×7Ñ7Ó9Ðô ˜×/Ñ/Ó1Ó2€NÜÐ,×3Ñ3Ó5Ó6ÐØ!#ÐØò 4ˆØ&ˆØ.9ÖK U¸TÀUº]š5ÐKˆÐKÚØ&×-Ñ-¨dÕ3ð	4ð
 $&Ð Ø ò 6ˆØ$ˆØ.9ÖK U¸TÀUº]š5ÐKˆÐKÚØ(×/Ñ/°Õ5ð	6ð "ò ˆØ×Ñ˜TÔ"ÜÓEÐ(DÔEÔEØˆKÙÜÓEÐ*DÔEÕEØˆKÙðð Ðàˆá +‰_Ð1B€Fð ˜F :Ñ.Ñ.°Ñ4€Oñ ˜mÐ->Ó?Ðð €EØ€EØ€Hä‹x€Hñ ˜X r¨4Ó0Ð1€Eà!ó E5ˆØ�6˜'‘?Ò"ð ˆHØà˜dÑ"à'+§z¡z°/Ó'BÑ$ˆI�}Ø1>×1DÑ1DÀTÓ1JÖK¨A˜aŸg™g�iÐKˆNÐKà!×(Ñ(Ó*ˆIØ$×+Ñ+¨C°Ó3‰LˆF�DØ—:‘:“<ˆDà�L‰L¨^Ö<¨˜1˜dš)Ò<Õ=ð  Ÿ;™; s¨AÓ.‰LˆF�DØ—:‘:“<ˆDà�y‰y‹{ˆà�6˜/Ñ*Ñ*ñ ,Ø—	‘	Ø—‘ØóˆMð
 �L‰L˜Ô'Ùô
 �V“ˆÙ˜t V¨TÓ2ˆà×"Ò"ð ð —+‘+ §¡Ò,Ø—y‘y“{�ð —+‘+ §¡Ó,ð �5Š=ð �L‰L˜Öð �L‰L˜ÔØ�L‰L˜Ôð �L‰L˜Ÿ™Ô#Ø�y‰y Ó(Ø—‘˜dŸi™i¨¯©Ð3Ö4ðKE5ñN ä�5‹z˜QŠÐˆñ $Œ"�*Š*¬¯©€CÙ
‹%€CØ×Ñ�uÔØ×Ñ�uÔØ€JøôE ò ÚðüòJ Lùò Lùòb Lùò =s5   ²R- Å'	R=Å1R=Æ	SÆ$SÉ=SËS
Ò-	R:Ò9R:)TNNFF)NTNNFú
F)Ú__doc__r   ÚwarningsÚcollectionsr   Únetworkxr•   Únetworkx.utilsr   Ú__all__r   r   r&   r.   r2   r4   r7   r   r   rW   rß   r   r   r   ú<module>rç      sÑ   ðñó Û Ý #ã Ý $à"Ð$8Ð
9€÷
ñ 
ô�jô ô˜/ô ô˜Oô ô	 �Jô 	 ô˜ô ô˜-ô ð ØØØØóZ(ñz
 ˆ1ˆcÓð 
ØØØØØØòxó ðxòv"óJLr   