+
    �°³j'  ã                   óð   € R t ^ RIHt ^ RIt^ RIHt . ROt]! ^RR7      R 4       t]! ^ RR7      ]P                  ! RRR	R
7      R 4       4       t
]P                  ! RR	R7      R 4       tR tRR ltRR ltR# )aÈ  
*****
Pydot
*****

Import and export NetworkX graphs in Graphviz dot format using pydot.

Either this module or nx_agraph can be used to interface with graphviz.

Examples
--------
>>> G = nx.complete_graph(5)
>>> PG = nx.nx_pydot.to_pydot(G)
>>> H = nx.nx_pydot.from_pydot(PG)

See Also
--------
 - pydot:         https://github.com/erocarrera/pydot
 - Graphviz:      https://www.graphviz.org
 - DOT Language:  http://www.graphviz.org/doc/info/lang.html
)ÚgetpreferredencodingN)Ú	open_fileÚw)Úmodec                óZ   € \        V 4      pVP                  VP                  4       4       R# )zÛWrite NetworkX graph G to Graphviz dot format on path.

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

path : string or file
   Filename or file handle for data output.
   Filenames ending in .gz or .bz2 will be compressed.
N)Úto_pydotÚwriteÚ	to_string)ÚGÚpathÚPs   && ÚZ/home/luca/screen-checking/.venv/lib/python3.14/site-packages/networkx/drawing/nx_pydot.pyÚ	write_dotr   &   s"   € ô 	�‹€AØ‡J�Jˆq�{‰{‹}ÔÙ
ó    ÚrÚpydot_read_dotT)ÚnameÚgraphsÚreturns_graphc                óp   € ^ RI pV P                  4       pVP                  V4      p\        V^ ,          4      # )aQ  Returns a NetworkX :class:`MultiGraph` or :class:`MultiDiGraph` from the
dot file with the passed path.

If this file contains multiple graphs, only the first such graph is
returned. All graphs _except_ the first are silently ignored.

Parameters
----------
path : str or file
    Filename or file handle to read.
    Filenames ending in .gz or .bz2 will be decompressed.

Returns
-------
G : MultiGraph or MultiDiGraph
    A :class:`MultiGraph` or :class:`MultiDiGraph`.

Notes
-----
Use `G = nx.Graph(nx.nx_pydot.read_dot(path))` to return a :class:`Graph` instead of a
:class:`MultiGraph`.
N)ÚpydotÚreadÚgraph_from_dot_dataÚ
from_pydot)r   r   ÚdataÚP_lists   &   r   Úread_dotr   7   s5   € ó2 à�9‰9‹;€Dð ×&Ñ& tÓ,€Fô �f˜Q•iÓ Ð r   )r   r   c                óN  €  V P                  4       pV'       * pV P                  4       R8X  d5   V'       d   \        P                  ! 4       pMI\        P
                  ! 4       pM3V'       d   \        P                  ! 4       pM\        P                  ! 4       pV P                  4       P                  R4      pVR8w  d   WCn
        V P                  4        FL  pVP                  4       P                  R4      pVR9   d   K+  VP                  ! V3/ VP                  4       B  KN  	  V P                  4        EF,  pVP                  4       pVP!                  4       p	VP                  4       p
. p. p\#        V\$        4      '       d"   VP'                  VP                  R4      4       M0VR,           F#  pVP'                  VP                  R4      4       K%  	  \#        V	\$        4      '       d"   VP'                  V	P                  R4      4       M0V	R,           F#  pVP'                  VP                  R4      4       K%  	  V F   pV F  pVP(                  ! VV3/ V
B  K  	  K"  	  EK/  	  V P                  4       pV'       d   VVP*                  R&    V P-                  4       ^ ,          VP*                  R&    V P1                  4       ^ ,          VP*                  R&   V#   \         d    T P                  R4      p ELâi ; i  \.        \        3 d     L]i ; i  \.        \        3 d     T# i ; i)	a˜  Returns a NetworkX graph from a Pydot graph.

Parameters
----------
P : Pydot graph
  A graph created with Pydot

Returns
-------
G : NetworkX multigraph
    A MultiGraph or MultiDiGraph.

Examples
--------
>>> K5 = nx.complete_graph(5)
>>> A = nx.nx_pydot.to_pydot(K5)
>>> G = nx.nx_pydot.from_pydot(A)  # return MultiGraph

# make a Graph instead of MultiGraph
>>> G = nx.Graph(nx.nx_pydot.from_pydot(A))

NÚgraphÚ"Ú ÚnodeÚedgeÚnodes)r!   r   r"   )Ú
get_strictÚ	TypeErrorÚget_typeÚnxÚ
MultiGraphÚGraphÚMultiDiGraphÚDiGraphÚget_nameÚstripr   Úget_node_listÚadd_nodeÚget_attributesÚget_edge_listÚ
get_sourceÚget_destinationÚ
isinstanceÚstrÚappendÚadd_edger   Úget_node_defaultsÚ
IndexErrorÚget_edge_defaults)r   ÚstrictÚ
multiedgesÚNr   ÚpÚnÚeÚuÚvÚattrÚsÚdÚunodesÚvnodesÚsource_nodeÚdestination_nodeÚpattrs   &                 r   r   r   [   sŠ  € ð4$Ø—‘“ˆð ”€Jà‡z�zƒ|�wÔßÜ—’“‰Aä—’“
‰AçÜ—’Ó!‰Aä—
’
“ˆAð �:‰:‹<×Ñ˜cÓ"€DØˆr„zØŒð �_‰_ÖˆØ�J‰J‹L×Ñ˜sÓ#ˆØÐ)Ô)ÙØ	�
Š
�1Ñ+˜×(Ñ(Ó*Ô+ñ	 ð �_‰_×ˆØ�L‰L‹NˆØ×ÑÓˆØ×ÑÓ!ˆØˆØˆä�aœ×ÒØ�H‰H�Q—W‘W˜S“\Õ"à˜GŸ*˜*�Ø—‘˜Ÿ™ cÓ*Ö+ñ %ô �aœ×ÒØ�H‰H�Q—W‘W˜S“\Õ"à˜GŸ*˜*�Ø—‘˜Ÿ™ cÓ*Ö+ñ %ó ˆKÛ$%Ð Ø—
’
˜;Ð(8ÑA¸DÔAó %&ô ñ' ð0 ×ÑÓ€EßØ ˆ�‰�ÑðØ×-Ñ-Ó/°Õ2ˆ�‰�‰ðØ×-Ñ-Ó/°Õ2ˆ�‰�‰ð €Høô ô $Ø—‘˜dÓ#‹ð$ûôr œ	Ð"ô Ùðûô œ	Ð"ô ØØ€Hðús5   ‚K Ê
$K8 Ê/$L ËK5Ë4K5Ë8LÌLÌL$Ì#L$c           	     óô  € ^ RI pV P                  4       '       d   RpMRp\        P                  ! V 4      ^ 8H  ;'       d    V P	                  4       '       * pV P
                  pV P                  P                  R/ 4      pVR8X  d   VP                  ! RRVRV/VB pMVP                  ! RV R23RVRV/VB p VP                  ! R/ V P                  R,          B   VP                  ! R/ V P                  R	,          B  V P                  R
R7       Fj  w  rxVP                  4        U	U
u/ uF  w  rš\        V	4      \        V
4      bK  	  pp	p
\        V4      pVP                  ! V3/ VB pVP!                  V4       Kl  	  V P	                  4       '       d£   V P#                  R
R
R7       F‰  w  rÚrïVP                  4        U	U
u/ uF#  w  ršV	R8w  g   K  \        V	4      \        V
4      bK%  	  pp	p
\        V4      \        X
4      r­VP$                  ! WÚ3R\        V4      /VB pVP'                  V4       K‹  	  V# V P#                  R
R7       Fu  w  rÚpVP                  4        U	U
u/ uF  w  rš\        V	4      \        V
4      bK  	  pp	p
\        V4      \        X
4      r­VP$                  ! WÚ3/ VB pVP'                  V4       Kw  	  V#   \         d     EL÷i ; i  \         d     ELåi ; iu up
p	i u up
p	i u up
p	i )zÙReturns a pydot graph from a NetworkX graph N.

Parameters
----------
N : NetworkX graph
  A graph created with NetworkX

Examples
--------
>>> K5 = nx.complete_graph(5)
>>> P = nx.nx_pydot.to_pydot(K5)

Notes
-----

NÚdigraphr   r    Ú
graph_typer;   r   r!   r"   T)r   )r   ÚkeysÚkey)r    © )r   Úis_directedr'   Únumber_of_selfloopsÚis_multigraphr   r   ÚgetÚDotÚset_node_defaultsÚKeyErrorÚset_edge_defaultsr#   Úitemsr5   ÚNoder/   ÚedgesÚEdger7   )r=   r   rM   r;   r   Úgraph_defaultsr   r?   ÚnodedataÚkrB   Ústr_nodedatar>   rA   rO   ÚedgedataÚstr_edgedatar"   s   &                 r   r   r   ¹   s­  € ó" ð 	‡}�}‡‚Ø‰
àˆ
Ü×#Ò# AÓ&¨!Ñ+×EÐE°A·O±OÓ4EÔ0E€Fà�6‰6€DØ—W‘W—[‘[ ¨"Ó-€NØˆr„zØ�IŠIÑQ ZÐQ¸ÐQÀ.ÑQ‰à�IŠIØ�ˆv�QˆKñ
Ø$.ð
Ø7=ð
ØAOñ
ˆðØ	×ÒÑ.˜aŸg™g f�oÒ.ðØ	×ÒÑ.˜aŸg™g f�oÒ.ð —w‘w D�wÖ)‰ˆØ3;·>±>Ô3CÔDÑ3C©4¨1œ˜A›¤ A£šÑ3CˆÑDÜ�‹FˆØ�JŠJ�qÑ)˜LÑ)ˆØ	�
‰
�1Žñ	 *ð 	‡�×ÒØ#$§7¡7°¸4 7Ö#@ÑˆA�#Ø7?·~±~Ô7GÔVÑ7G©t¨qÈ1ÐPUÉ:œNœC ›F¤C¨£FšNÑ7GˆLÑVÜ�q“6œ3˜q›6ˆqØ—:’:˜aÑA¬¨C«ÐA°LÑAˆDØ�J‰J�tÖñ	 $Að €Hð  Ÿg™g¨4˜gÖ0‰NˆA�(Ø7?·~±~Ô7GÔHÑ7G©t¨qœC ›F¤C¨£FšNÑ7GˆLÑHÜ�q“6œ3˜q›6ˆqØ—:’:˜aÑ3 lÑ3ˆDØ�J‰J�tÖñ	 1ð
 €Høô5 ô Úðûô ô Úðüó Eùó Wùó Is<   Â8#K Ã#K Ä) K(ÇK.ÇK.É" K4ËKËKËK%Ë$K%c                ó   € \        WVR7      # )aá  Create node positions using Pydot and Graphviz.

Returns a dictionary of positions keyed by node.

Parameters
----------
G : NetworkX Graph
    The graph for which the layout is computed.
prog : string (default: 'neato')
    The name of the GraphViz program to use for layout.
    Options depend on GraphViz version but may include:
    'dot', 'twopi', 'fdp', 'sfdp', 'circo'
root : Node from G or None (default: None)
    The node of G from which to start some layout algorithms.

Returns
-------
  Dictionary of (x, y) positions keyed by node.

Examples
--------
>>> G = nx.complete_graph(4)
>>> pos = nx.nx_pydot.graphviz_layout(G)
>>> pos = nx.nx_pydot.graphviz_layout(G, prog="dot")

Notes
-----
This is a wrapper for pydot_layout.
©r
   ÚprogÚroot)Úpydot_layoutrd   s   &&&r   Úgraphviz_layoutrh   ú   s   € ô< ˜!¨TÔ2Ð2r   c                óú  € ^ RI p\        V 4      pVe   VP                  R\        V4      4       VP	                  VR7      p\        V\        4       R7      pVR8X  dL   \        RV R24       \        4        \        R4       \        R	4       \        R
4       \        RV R24       R# VP                  V4      p\        V4      ^8X  g   Q hV^ ,          p/ p	V P                  4        F‘  p
\        V
4      pVP                  VP                  V4      4      p\        V\        4      '       d
   V^ ,          pVP                  4       ^R pVf   Kf  VP                  R4      w  rï\!        V4      \!        V4      3Wš&   K“  	  V	# )a|  Create node positions using :mod:`pydot` and Graphviz.

Parameters
----------
G : Graph
    NetworkX graph to be laid out.
prog : string  (default: 'neato')
    Name of the GraphViz command to use for layout.
    Options depend on GraphViz version but may include:
    'dot', 'twopi', 'fdp', 'sfdp', 'circo'
root : Node from G or None (default: None)
    The node of G from which to start some layout algorithms.

Returns
-------
dict
    Dictionary of positions keyed by node.

Examples
--------
>>> G = nx.complete_graph(4)
>>> pos = nx.nx_pydot.pydot_layout(G)
>>> pos = nx.nx_pydot.pydot_layout(G, prog="dot")

Notes
-----
If you use complex node objects, they may have the same string
representation and GraphViz could treat them as the same node.
The layout may assign both nodes a single location. See Issue #1568
If this occurs in your case, consider relabeling the nodes just
for the layout computation using something similar to::

    H = nx.convert_node_labels_to_integers(G, label_attribute="node_label")
    H_layout = nx.nx_pydot.pydot_layout(H, prog="dot")
    G_layout = {H.nodes[n]["node_label"]: p for n, p in H_layout.items()}

Nrf   )re   )Úencodingr    zGraphviz layout with z failedzTo debug what happened try:zP = nx.nx_pydot.to_pydot(G)zP.write_dot("file.dot")zAnd then run z on file.dotÚ,éÿÿÿÿ)r   r   Úsetr5   Ú
create_dotr   Úprintr   Úlenr#   Úget_nodeÚquote_id_if_necessaryr4   ÚlistÚget_posÚsplitÚfloat)r
   re   rf   r   r   ÚD_bytesÚDÚQ_listÚQÚnode_posr?   Ústr_nr!   ÚposÚxxÚyys   &&&             r   rg   rg     sW  € óL ä�‹€AØÒØ	�‰ˆf”c˜$“iÔ ð �l‰l ˆlÓ%€Gô 	ˆGÔ2Ó4Ô5€AàˆB„wÜÐ% d V¨7Ð3Ô4ÜŒÜÐ+Ô,ÜÐ+Ô,ÜÐ'Ô(Ü�˜d˜V <Ð0Ô1Ùð ×&Ñ& qÓ)€FÜˆv‹;˜!ÔÐÐð 	ˆq�	€Aà€HØ�W‰WŽYˆÜ�A“ˆØ�z‰z˜%×5Ñ5°eÓ<Ó=ˆä�dœD×!Ò!Ø˜•7ˆDØ�l‰l‹n˜Q˜rÐ"ˆØŒ?Ø—Y‘Y˜s“^‰FˆBÜ  ›9¤e¨B£iÐ0ˆH‹Kñ ð €Or   )r   r   rh   rg   r   r   )ÚneatoN)Ú__doc__Úlocaler   Únetworkxr'   Únetworkx.utilsr   Ú__all__r   Ú_dispatchabler   r   r   rh   rg   rP   r   r   Ú<module>r‡      s¢   ðñõ, (ã Ý $ò€ñ ˆ1�3Ôñó ðñ  ˆ1�3ÔØ×ÒÐ'°ÀDÔIñ!ó Jó ð!ðD ×Ò˜¨TÔ2ñZó 3ðZòz>ôB3öBNr   