
    h"                     l    S SK r S SKrS rS rS r\R                  4S jr\R                  4S jrS r	g)    Nc                     [         R                  " S[         R                  S9n U  Vs0 s H  oX4_M     nnU R                  SS5        SU R                  S   S'   SU R                  S   S'   S	U R
                  S   S
'   SU R
                  S   S
'   SU R
                  S   S
'   SU R
                  S   S'   SU R                  S   S'   SU R                  S   S'   SU R                  S   S'   SU R                  S   S'   SU R                  S   S
'   SU R                  S   S'   SU R                  S   S'   SU R                  S   S
'   [         R                  " U USSS
S
SSSS9	nSnX4:X  d   eg s  snf ) N   create_usingr   Loop)r   r   labelmidwaylabel_optionsbluestylezline width=3,draw   zcircle,draw,blue!50   Stop   z1st Stepr   r   znear endz3rd Step)r   r   z
near startzbend left,green2ndr   r   zpos=0.5z$>->,bend right,line width=3,green!90Fz	[scale=3])posas_documenttikz_optionsnode_optionsedge_options
node_label
edge_labeledge_label_optionsa(  \begin{figure}
  \begin{tikzpicture}[scale=3]
      \draw
        (0, 0) node[blue] (0){0}
        (1, 1) node[line width=3,draw] (1){1}
        (2, 2) node[circle,draw,blue!50] (2){2}
        (3, 3) node (3){Stop};
      \begin{scope}[->]
        \draw (0) to node[near end] {1st Step} (1);
        \draw[loop,] (0) to node[midway] {Loop} (0);
        \draw[>->,bend right,line width=3,green!90] (1) to node[pos=0.5] {2nd} (2);
        \draw[bend left,green] (2) to node[near start] {3rd Step} (3);
      \end{scope}
    \end{tikzpicture}
\end{figure})nx
path_graphDiGraphadd_edgeedgesnodesto_latex)Gnr   
output_texexpected_texs        S/var/www/html/env/lib/python3.13/site-packages/networkx/drawing/tests/test_latex.pytest_tikz_attributesr(      s|   
abjj1A
 aqf9aC
 JJq!%AGGFOG'/AGGFOO$ AGGAJw-AGGAJw/AGGAJw AGGAJw)AGGFOG'1AGGFOO$)AGGFOG'3AGGFOO$0AGGFOG$AGGFOG'0AGGFOO$EAGGFOG	 *
JL  %%%] !s   E+c                     [         R                  " S5      n [         R                  " S5      n[         R                  " S5      n[         R                  " S5      n/ SQn/ SQn[         R                  " XX#/SUUS9nSU;   d   eSU;   d   eUR	                  S	5      S:X  d   eUR	                  S
5      S:X  d   eUR	                  S5      S:X  d   eg )Nr      )zPath on 4 nodeszComplete graph on 4 nodeszPath on 8 nodeszComplete graph on 8 nodes)fig2afig2bfig2cfig2dr   )n_rowssub_captions
sub_labelszbegin{document}zbegin{figure}zbegin{subfigure}tikzpicturez[-])r   r   complete_graphr"   count)H1H2H3H4captionslabels
latex_codes          r'   test_basic_multiple_graphsr<   A   s    	q	B			1	B	q	B			1	BH 2F		J 
***j(((./1444M*a///E"a'''    c                     Sn / SQn[         R                  " 5       nUR                  [        S5      5        UR	                  U5        SSSSSS	S
SS.nSSSSS.nSSSSS.nUR                  5       n[         R                  " X$S5        [         R                  " XeS5        SS/nSS/n[         R                  " X&/X3/SSSSUUSSSS9n	X:X  d   eg )NaF  \documentclass{report}
\usepackage{tikz}
\usepackage{subcaption}

\begin{document}
\begin{figure}
  \begin{subfigure}{0.5\textwidth}
  \begin{tikzpicture}[scale=2]
      \draw[gray!90]
        (0.749, 0.702) node[red!90] (0){0}
        (1.0, -0.014) node[red!90] (1){1}
        (-0.777, -0.705) node (2){2}
        (-0.984, 0.042) node (3){3}
        (-0.028, 0.375) node[cyan!90] (4){4}
        (-0.412, 0.888) node (5){5}
        (0.448, -0.856) node (6){6}
        (0.003, -0.431) node[cyan!90] (7){7};
      \begin{scope}[->,gray!90]
        \draw (0) to (4);
        \draw (0) to (5);
        \draw (0) to (6);
        \draw (0) to (7);
        \draw (1) to (4);
        \draw (1) to (5);
        \draw (1) to (6);
        \draw (1) to (7);
        \draw (2) to (4);
        \draw (2) to (5);
        \draw (2) to (6);
        \draw (2) to (7);
        \draw (3) to (4);
        \draw (3) to (5);
        \draw (3) to (6);
        \draw (3) to (7);
      \end{scope}
    \end{tikzpicture}
    \caption{My tikz number 1 of 2}\label{tikz_1_2}
  \end{subfigure}
  \begin{subfigure}{0.5\textwidth}
  \begin{tikzpicture}[scale=2]
      \draw[gray!90]
        (0.749, 0.702) node[green!90] (0){0}
        (1.0, -0.014) node[green!90] (1){1}
        (-0.777, -0.705) node (2){2}
        (-0.984, 0.042) node (3){3}
        (-0.028, 0.375) node[purple!90] (4){4}
        (-0.412, 0.888) node (5){5}
        (0.448, -0.856) node (6){6}
        (0.003, -0.431) node[purple!90] (7){7};
      \begin{scope}[->,gray!90]
        \draw (0) to (4);
        \draw (0) to (5);
        \draw (0) to (6);
        \draw (0) to (7);
        \draw (1) to (4);
        \draw (1) to (5);
        \draw (1) to (6);
        \draw (1) to (7);
        \draw (2) to (4);
        \draw (2) to (5);
        \draw (2) to (6);
        \draw (2) to (7);
        \draw (3) to (4);
        \draw (3) to (5);
        \draw (3) to (6);
        \draw (3) to (7);
      \end{scope}
    \end{tikzpicture}
    \caption{My tikz number 2 of 2}\label{tikz_2_2}
  \end{subfigure}
  \caption{A graph generated with python and latex.}
\end{figure}
\end{document}))r   r   )r      )r      )r      )r   r   )r   r?   )r   r@   )r   rA   )r   r   )r   r?   )r   r@   )r   rA   )r   r   )r   r?   )r   r@   )r   rA   r*   )g`5?g'y?)g      ?gMR )g/κg	ƒ)gw!g^c?)g͛YgI1?)gDQVڿg]]Pj?)gGgǨ?g'e)g@j?g+?Cۿ)r   r   r   r   r   r?   r@   rA   zred!90zcyan!90)r   r   r   rA   zgreen!90z	purple!90colorzMy tikz number 1 of 2zMy tikz number 2 of 2tikz_1_2tikz_2_2z	[scale=2]zgray!90z(A graph generated with python and latex.r   T)	r   default_node_optionsdefault_edge_optionsr   r0   r1   captionr/   r   )r   r   add_nodes_fromrangeadd_edges_fromcopyset_node_attributesr"   )
r&   r    r#   r   rc_node_colorgp_node_colorHr0   r1   r%   s
             r'   test_basic_tikzrP   [   s    HLTE$ 	

AU1XU2'555558	C !X)	JM"zkkRM	A1W51W5+-DELj)J	
	
 &&!:J %%%r=   c                    [         R                  " S5      nU " USS9  SSSS.n[        R                  " [         R                  5         U " X5        S S S 5        SUS	'   [        R                  " [         R                  5         U " X5        S S S 5        S
US	'   [        R                  " [         R                  5         U " X5        S S S 5        SUS	'   U " X5        g ! , (       d  f       N= f! , (       d  f       Ng= f! , (       d  f       N>= f)Nr   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   pytestraisesNetworkXError)r"   r#   r   s      r'   test_exception_pos_single_graphrX      s    
aAQE F
+C	r''	( 
) CF	r''	( 
)CF	r''	( 
) CFQ 
)	(
 
)	( 
)	(s$   	C	C,<	C=
C),
C:=
Dc                 d   [         R                  " S5      nSSS.nSSSS.nXX/nX3X3/nU " XC5        [        R                  " [         R                  5         U " XB5        S S S 5        U " XE5        [        R                  " [         R                  5         U " XBX"U/5        S S S 5        [        R                  " [         R                  5         U " XCX2U/5        S S S 5        [        R                  " [         R                  5         U " XESS/S9  S S S 5        [        R                  " [         R                  5         U " XESS/S9  S S S 5        U " XES/S	-  S
/S	-  S9  g ! , (       d  f       GN= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       Nd= f)Nr   r   r   rR   rS   hi)r0   )r1   r   lbl)r0   r1   rT   )r"   r#   pos_badpos_OKfourGfourposs         r'   test_exception_multiple_graphsr`      sO   
aAV$GFv.F1LEv.G U	r''	(  
) U	r''	('G<= 
) 
r''	(&9: 
) 
r''	(tTl; 
) 
r''	(T4L9 
) U4&1*%1M) 
)	(
 
)	( 
)	( 
)	( 
)	(s<   	EE.E?
F9
F!
E+.
E<?
F
F!
F/c                     [         R                  " S[         R                  S9n U R                  SS5        [        R
                  " [         R                  5         [         R                  " U 5        S S S 5        g ! , (       d  f       g = f)Nr   r   r   r   )r   r   
MultiGraphr   rU   rV   NetworkXNotImplementedr"   )r#   s    r'   test_exception_multigraphrd      sM    
abmm4AJJq!	r00	1
A 
2	1	1s   A::
B)
rU   networkxr   r(   r<   rP   r"   rX   r`   rd    r=   r'   <module>rg      s@     0&v(4C&\ .0[[ . -/KK N@r=   