
    hA                    h   S r SSKrSSKrSSKJr  SSKrSSKJrJ	r	J
r
JrJrJrJrJr  / SQrSS jrSS jr              SS jr " S	 S
5      r                    SS jr            SS jr                 SS jrS rS rS rS rS rSS jrS rS rSS jr g)a  
**********
Matplotlib
**********

Draw networks with matplotlib.

Examples
--------
>>> G = nx.complete_graph(5)
>>> nx.draw(G)

See Also
--------
 - :doc:`matplotlib <matplotlib:index>`
 - :func:`matplotlib.pyplot.scatter`
 - :obj:`matplotlib.patches.FancyArrowPatch`
    N)Number)circular_layoutforceatlas2_layoutkamada_kawai_layoutplanar_layoutrandom_layoutshell_layoutspectral_layoutspring_layout)drawdraw_networkxdraw_networkx_nodesdraw_networkx_edgesdraw_networkx_labelsdraw_networkx_edge_labelsdraw_circulardraw_kamada_kawaidraw_randomdraw_spectraldraw_springdraw_planar
draw_shelldraw_forceatlas2c                 ^   SSK Jn  Uc  UR                  5       nOUR                  5       nUR	                  S5        Uc3  UR
                  (       a  UR                  5       nOUR                  S5      nSU;  a  SU;   US'   [        U 4XS.UD6  UR                  5         UR                  5         g)a  Draw the graph G with Matplotlib.

Draw the graph as a simple representation with no node
labels or edge labels and using the full Matplotlib figure area
and no axis labels by default.  See draw_networkx() for more
full-featured drawing that allows title, axis labels etc.

Parameters
----------
G : graph
    A networkx graph

pos : dictionary, optional
    A dictionary with nodes as keys and positions as values.
    If not specified a spring layout positioning will be computed.
    See :py:mod:`networkx.drawing.layout` for functions that
    compute node positions.

ax : Matplotlib Axes object, optional
    Draw the graph in specified Matplotlib axes.

kwds : optional keywords
    See networkx.draw_networkx() for a description of optional keywords.

Examples
--------
>>> G = nx.dodecahedral_graph()
>>> nx.draw(G)
>>> nx.draw(G, pos=nx.spring_layout(G))  # use spring layout

See Also
--------
draw_networkx
draw_networkx_nodes
draw_networkx_edges
draw_networkx_labels
draw_networkx_edge_labels

Notes
-----
This function has the same name as pylab.draw and pyplot.draw
so beware when using `from networkx import *`

since you might overwrite the pylab.draw function.

With pyplot use

>>> import matplotlib.pyplot as plt
>>> G = nx.dodecahedral_graph()
>>> nx.draw(G)  # networkx draw()
>>> plt.draw()  # pyplot draw()

Also see the NetworkX drawing examples at
https://networkx.org/documentation/latest/auto_examples/index.html
r   Nw)r   r      r   with_labelslabels)posax)matplotlib.pyplotpyplotgcf
get_figureset_facecoloraxesgcaadd_axesr   set_axis_offdraw_if_interactive)Gr   r    kwdspltcfs         K/var/www/html/env/lib/python3.13/site-packages/networkx/drawing/nx_pylab.pyr   r   6   s    p $	zWWY]]_S	z77B\*BD &$.]!,,t,OO
    c                   ^ SSK Jn  SSKJn  U" [        5      R
                  R                  5       nU" [        5      R
                  R                  5       nU" [        5      R
                  R                  5       n	Xx-  U	-  1 Sk-
  m[        U4S jU 5       5      (       a7  SR                  U V
s/ s H  oT;  d  M
  U
PM     sn
5      n[        SU 35      eUR                  5        V
Vs0 s H  u  pX;   d  M  X_M     nn
nUR                  5        V
Vs0 s H  u  pX;   d  M  X_M     nn
nUR                  5        V
Vs0 s H  u  pX;   d  M  X_M     nn
nUc  [        R                  R                  U 5      n[	        X40 UD6  [        X4SU0UD6  U(       a  [        X40 UD6  UR!                  5         gs  sn
f s  snn
f s  snn
f s  snn
f )	a  Draw the graph G using Matplotlib.

Draw the graph with Matplotlib with options for node positions,
labeling, titles, and many other drawing features.
See draw() for simple drawing without labels or axes.

Parameters
----------
G : graph
    A networkx graph

pos : dictionary, optional
    A dictionary with nodes as keys and positions as values.
    If not specified a spring layout positioning will be computed.
    See :py:mod:`networkx.drawing.layout` for functions that
    compute node positions.

arrows : bool or None, optional (default=None)
    If `None`, directed graphs draw arrowheads with
    `~matplotlib.patches.FancyArrowPatch`, while undirected graphs draw edges
    via `~matplotlib.collections.LineCollection` for speed.
    If `True`, draw arrowheads with FancyArrowPatches (bendable and stylish).
    If `False`, draw edges using LineCollection (linear and fast).
    For directed graphs, if True draw arrowheads.
    Note: Arrows will be the same color as edges.

arrowstyle : str (default='-\|>' for directed graphs)
    For directed graphs, choose the style of the arrowsheads.
    For undirected graphs default to '-'

    See `matplotlib.patches.ArrowStyle` for more options.

arrowsize : int or list (default=10)
    For directed graphs, choose the size of the arrow head's length and
    width. A list of values can be passed in to assign a different size for arrow head's length and width.
    See `matplotlib.patches.FancyArrowPatch` for attribute `mutation_scale`
    for more info.

with_labels :  bool (default=True)
    Set to True to draw labels on the nodes.

ax : Matplotlib Axes object, optional
    Draw the graph in the specified Matplotlib axes.

nodelist : list (default=list(G))
    Draw only specified nodes

edgelist : list (default=list(G.edges()))
    Draw only specified edges

node_size : scalar or array (default=300)
    Size of nodes.  If an array is specified it must be the
    same length as nodelist.

node_color : color or array of colors (default='#1f78b4')
    Node color. Can be a single color or a sequence of colors with the same
    length as nodelist. Color can be string or rgb (or rgba) tuple of
    floats from 0-1. If numeric values are specified they will be
    mapped to colors using the cmap and vmin,vmax parameters. See
    matplotlib.scatter for more details.

node_shape :  string (default='o')
    The shape of the node.  Specification is as matplotlib.scatter
    marker, one of 'so^>v<dph8'.

alpha : float or None (default=None)
    The node and edge transparency

cmap : Matplotlib colormap, optional
    Colormap for mapping intensities of nodes

vmin,vmax : float, optional
    Minimum and maximum for node colormap scaling

linewidths : scalar or sequence (default=1.0)
    Line width of symbol border

width : float or array of floats (default=1.0)
    Line width of edges

edge_color : color or array of colors (default='k')
    Edge color. Can be a single color or a sequence of colors with the same
    length as edgelist. Color can be string or rgb (or rgba) tuple of
    floats from 0-1. If numeric values are specified they will be
    mapped to colors using the edge_cmap and edge_vmin,edge_vmax parameters.

edge_cmap : Matplotlib colormap, optional
    Colormap for mapping intensities of edges

edge_vmin,edge_vmax : floats, optional
    Minimum and maximum for edge colormap scaling

style : string (default=solid line)
    Edge line style e.g.: '-', '--', '-.', ':'
    or words like 'solid' or 'dashed'.
    (See `matplotlib.patches.FancyArrowPatch`: `linestyle`)

labels : dictionary (default=None)
    Node labels in a dictionary of text labels keyed by node

font_size : int (default=12 for nodes, 10 for edges)
    Font size for text labels

font_color : color (default='k' black)
    Font color string. Color can be string or rgb (or rgba) tuple of
    floats from 0-1.

font_weight : string (default='normal')
    Font weight

font_family : string (default='sans-serif')
    Font family

label : string, optional
    Label for graph legend

hide_ticks : bool, optional
    Hide ticks of axes. When `True` (the default), ticks and ticklabels
    are removed from the axes. To set ticks and tick labels to the pyplot default,
    use ``hide_ticks=False``.

kwds : optional keywords
    See networkx.draw_networkx_nodes(), networkx.draw_networkx_edges(), and
    networkx.draw_networkx_labels() for a description of optional keywords.

Notes
-----
For directed graphs, arrows  are drawn at the head end.  Arrows can be
turned off with keyword arrows=False.

Examples
--------
>>> G = nx.dodecahedral_graph()
>>> nx.draw(G)
>>> nx.draw(G, pos=nx.spring_layout(G))  # use spring layout

>>> import matplotlib.pyplot as plt
>>> limits = plt.axis("off")  # turn off axis

Also see the NetworkX drawing examples at
https://networkx.org/documentation/latest/auto_examples/index.html

See Also
--------
draw
draw_networkx_nodes
draw_networkx_edges
draw_networkx_labels
draw_networkx_edge_labels
r   )	signatureN>   r+   r   arrowsr   c              3   ,   >#    U  H	  oT;  v   M     g 7fN ).0k
valid_kwdss     r/   	<genexpr> draw_networkx.<locals>.<genexpr>/  s     
-1Js   z, zReceived invalid argument(s): r3   )inspectr2   r!   r"   r   
parameterskeysr   r   anyjoin
ValueErroritemsnxdrawingr   r*   )r+   r   r3   r   r,   r2   r-   valid_node_kwdsvalid_edge_kwdsvalid_label_kwdsr8   invalid_argsv	node_kwds	edge_kwds
label_kwdsr9   s                   @r/   r   r      s   n "#
   34??DDFO 34??DDFO !56AAFFH "36FF K J 
-
---yyT!ITj5H!T!IJ9,HII"&**,G,$!!2F,IG"&**,G,$!!2F,IG#'::<I<4113H$!$<JI
{jj&&q),),;v;;Q2z2 "J HGIs0   /	F8<F8*F=9F=G$G G	G	c                    SSK Jn  SSKnSSKnSSKJn  SSKnU
c  UR                  5       n
Uc  [        U 5      n[        U5      S:X  a  UR                  R                  S5      $  UR                  U Vs/ s H  nUU   PM
     sn5      n[!        UU5      (       a  [#        XFX'X5      nSn[!        UUR$                  5      (       dI  [!        U[        5      (       d4  UR'                  [)        [        U5      5       Vs/ s H  nUPM     sn5      nUR+                  U5       H-  nU
R-                  UUU:H  S4   UUU:H  S4   UUUUUU	UUUUS9nM/     U(       a  U
R/                  SSS	S	S	S	S
9  Ub2  [!        UU5      (       a  U
R0                  " U6   OU
R1                  U5        WR3                  S5        U$ s  snf ! [         a   n[        R                  " SU S35      UeSnAff = fs  snf )a  Draw the nodes of the graph G.

This draws only the nodes of the graph G.

Parameters
----------
G : graph
    A networkx graph

pos : dictionary
    A dictionary with nodes as keys and positions as values.
    Positions should be sequences of length 2.

ax : Matplotlib Axes object, optional
    Draw the graph in the specified Matplotlib axes.

nodelist : list (default list(G))
    Draw only specified nodes

node_size : scalar or array (default=300)
    Size of nodes.  If an array it must be the same length as nodelist.

node_color : color or array of colors (default='#1f78b4')
    Node color. Can be a single color or a sequence of colors with the same
    length as nodelist. Color can be string or rgb (or rgba) tuple of
    floats from 0-1. If numeric values are specified they will be
    mapped to colors using the cmap and vmin,vmax parameters. See
    matplotlib.scatter for more details.

node_shape :  string (default='o')
    The shape of the node.  Specification is as matplotlib.scatter
    marker, one of 'so^>v<dph8'.

alpha : float or array of floats (default=None)
    The node transparency.  This can be a single alpha value,
    in which case it will be applied to all the nodes of color. Otherwise,
    if it is an array, the elements of alpha will be applied to the colors
    in order (cycling through alpha multiple times if necessary).

cmap : Matplotlib colormap (default=None)
    Colormap for mapping intensities of nodes

vmin,vmax : floats or None (default=None)
    Minimum and maximum for node colormap scaling

linewidths : [None | scalar | sequence] (default=1.0)
    Line width of symbol border

edgecolors : [None | scalar | sequence] (default = node_color)
    Colors of node borders. Can be a single color or a sequence of colors with the
    same length as nodelist. Color can be string or rgb (or rgba) tuple of floats
    from 0-1. If numeric values are specified they will be mapped to colors
    using the cmap and vmin,vmax parameters. See `~matplotlib.pyplot.scatter` for more details.

label : [None | string]
    Label for legend

margins : float or 2-tuple, optional
    Sets the padding for axis autoscaling. Increase margin to prevent
    clipping for nodes that are near the edges of an image. Values should
    be in the range ``[0, 1]``. See :meth:`matplotlib.axes.Axes.margins`
    for details. The default is `None`, which uses the Matplotlib default.

hide_ticks : bool, optional
    Hide ticks of axes. When `True` (the default), ticks and ticklabels
    are removed from the axes. To set ticks and tick labels to the pyplot default,
    use ``hide_ticks=False``.

Returns
-------
matplotlib.collections.PathCollection
    `PathCollection` of the nodes.

Examples
--------
>>> G = nx.dodecahedral_graph()
>>> nodes = nx.draw_networkx_nodes(G, pos=nx.spring_layout(G))

Also see the NetworkX drawing examples at
https://networkx.org/documentation/latest/auto_examples/index.html

See Also
--------
draw
draw_networkx
draw_networkx_edges
draw_networkx_labels
draw_networkx_edge_labels
r   )IterableNzNode z has no position.r   )
scmarkercmapvminvmaxalpha
linewidths
edgecolorslabelbothFaxiswhichbottomleftlabelbottom	labelleft   )collections.abcrN   
matplotlibmatplotlib.collectionsr!   r"   numpyr'   listlencollectionsPathCollectionasarrayKeyErrorrC   NetworkXError
isinstanceapply_alphandarrayarrayrangeuniquescattertick_paramsmargins
set_zorder)r+   r   nodelist	node_size
node_color
node_shaperU   rR   rS   rT   r    rV   rW   rX   ru   
hide_ticksrN   mplrc   r-   nprI   xyerr_shapenode_collections                              r/   r   r   A  s   V )!#	zWWY7
8}--d33HZZ2AQ23 %"" HDO
j"**--jT6R6RXX5X3GH3Gaz3GHI
:&**zU"A%&zU"A%&!! % 
 ' 
 	 	
 gx((JJ JJwq!W 3 Hse+<=>CGH Is0   %F8 4F3F8 ;G%3F8 8
G"GG"c                   X    \ rS rSrSr " S S5      r           S
S jrS rS rS	r	g)FancyArrowFactoryi  z5Draw arrows with `matplotlib.patches.FancyarrowPatch`c                   *    \ rS rSrSS jrS rS rSrg)(FancyArrowFactory.ConnectionStyleFactoryi  Nc                     SS K nSS KnSS KnX0l        X@l        X`l        U Vs/ s H  otR                  R                  U5      PM     snU l        [        U R                  5      U l
        X l        g s  snf Nr   )rc   matplotlib.pathre   r    r|   r}   patchesConnectionStylebase_connection_stylesrg   nselfloop_height)selfconnectionstylesr   r    r|   rc   r}   css           r/   __init__1FancyArrowFactory.ConnectionStyleFactory.__init__  sc    $"GHG:J+:JB++B/:J+D' 445DF#2 	+s   $A0c                 8    U R                   XR                  -     $ r5   )r   r   )r   
edge_indexs     r/   curved/FancyArrowFactory.ConnectionStyleFactory.curved  s    ..zFF/BCCr0   c                    ^ ^ UU 4S jnU$ )Nc           
        > TR                   R                  X:H  5      (       d  [        R                  " S5      eTR                  R
                  R                  5       R                  U 5      nSTR                  -  nUS-  nTR                   R                  SU/Xe/US/SS/U* S/U* U/SU//5      nTS-  (       aL  UR                  u  p[        TS-  5       H  n
X* pM     TR                   R                  X/5      R                  nTR                  R                  R                  TR                  R
                  R                  XG-   5      / SQ5      $ )NzD`self_loop` connection style methodis only to be used for self-loopsg?      ?r      )r   r   r   r   r   r   r   )r}   allrC   rl   r    	transDatainverted	transformr   rj   Trq   rp   r|   pathPath)posAposBargskwargsdata_locv_shifth_shiftr   xyr   r   r   s              r/   self_loop_connectionPFancyArrowFactory.ConnectionStyleFactory.self_loop.<locals>.self_loop_connection  s<   ww{{4<00**<   77,,557AA$G 4 44!C-ww G * !A!1!7+G  >66DA":>2 "1 377==!022Dxx}}))GG%%//@BW r0   r6   )r   r   r   s   `` r/   	self_loop2FancyArrowFactory.ConnectionStyleFactory.self_loop   s    #J ('r0   )r    r   r|   r   r}   r   r5   )__name__
__module____qualname____firstlineno__r   r   r   __static_attributes__r6   r0   r/   ConnectionStyleFactoryr     s    	3	D&	(r0   r   Nc                 ~   SS K nSS KnSS KJn  SS Kn[        U[        5      (       a  U/nO:UR                  U5      (       a  [        U5      nOSn[        R                  " U5      eUU l        UU l        UU l        Xl        X l        X0l        Xl        Xl        UU l        X@l        XPl        U R-                  XvU5      U l        Xl        Xl        UR4                  R6                  R9                  X5      U l        Xl        Xl        [        U
[        5      (       a$  [A        U
5      [A        U5      :w  a  [C        S5      eg g )Nr   zDConnectionStyleFactory arg `connectionstyle` must be str or iterablez1arrowsize should have the same length as edgelist)"rc   matplotlib.patchesr!   r"   re   rm   striterablerf   rC   rl   r    r|   r}   edge_posedgelistrw   rz   min_source_marginmin_target_marginedge_indicesrx   r   connectionstyle_factory
arrowstyle	arrowsizecolorscolorConverterto_rgba_arrayarrow_colors	linewidthstylerg   rA   )r   r   r   rw   r   rx   r   connectionstylerz   r   r   
edge_colorrU   r   r   r   r   r    r|   rc   r-   r}   msgs                          r/   r   FancyArrowFactory.__init__(  s   ( 	!!'os++./O[[))"?3OXC""3''   $!2!2("'+'B'Bb(
$ %"JJ55CCJV"
i&&3y>S]+JPQQ ,K&r0   c                 \
   U R                   U   u  u  p#u  pESnSnU R                  R                  U R                  5      (       aN  [	        U R                  [
        5      (       d/  [	        U R                  [        5      (       d  U R                  U   nOU R                  nU R                  R                  U R                  5      (       aN  [	        U R                  [
        5      (       d/  [	        U R                  [        5      (       d  U R                  U   n	OU R                  n	U R                  R                  U R                  5      (       a  U R                  U   S S u  pU R                  U R                  R                  U
5         nU R                  U R                  R                  U5         nU R                  XR                  5      nU R                  XR                  5      nO(U R                  U R                  U R                  5      nUn[        Xh5      n[        Xy5      n[	        U R                  [         5      (       a  U R                  U   nOU R                  n[#        U R$                  5      U:  a  U R$                  U   nON[#        U R$                  5      S:X  a  U R$                  S   nO%U R$                  U[#        U R$                  5      -     nU R                  R                  U R&                  5      (       aO  [#        U R&                  5      U:  a  U R&                  U   nO2U R&                  U[#        U R&                  5      -     nOU R&                  nU R                  R                  U R(                  5      (       a  [	        U R(                  [
        5      (       dn  [	        U R(                  [        5      (       dO  [#        U R(                  5      U:  a  U R(                  U   nO2U R(                  U[#        U R(                  5      -     nOU R(                  nX$:X  a.  X5:X  a)  U R*                  R-                  U R.                  U   5      nO(U R*                  R1                  U R.                  U   5      nU R                  R                  U R2                  5      (       aN  [	        U R2                  [
        5      (       d/  [	        U R2                  [        5      (       d  U R2                  U   nOU R2                  nU R4                  R6                  R9                  X#4XE4UUUUUUUUSS9$ )Nr   ra   r   )	r   shrinkAshrinkBmutation_scalecolorr   r   	linestylezorder)r   r}   r   r   rm   r   tupler   rx   r   rw   indexto_marker_edgerz   maxr   rf   rg   r   r   r   r   r   r   r   r   r|   r   FancyArrowPatch)r   ix1y1x2y2shrink_sourceshrink_targetr   r   sourcetargetsource_node_sizetarget_node_sizer   arrow_colorr   r   r   r   s                       r/   __call__FancyArrowFactory.__call__^  s   !]]1-(2GGT3344t55s;;t55u== $ 6 6q 9 $ 6 6 GGT3344t55s;;t55u== $ 6 6q 9 $ 6 677DNN++!]]1-bq1NF#~~dmm.A.A&.IJ#~~dmm.A.A&.IJ //0@//RM //0@//RM //PM)MM=M= dnnd++!^^A.N!^^Nt  !A%++A.K""#q(++A.K++AD4E4E0F,FGK77DNN++4>>"Q& NN1-	 NN1s4>>/B+BC	I GGTZZ((tzz3//tzz5114::" JJqM	 JJq3tzz?':;	

I8"::DD!!!$O #::AA$BSBSTUBVWO GGT__--t44t66+JJxx//HH!!!)+ 0 
 	
r0   c                     US;   a!  U R                   R                  SU-  5      S-  $ U R                   R                  U5      S-  $ )Nzs^>v<dra   )r}   sqrt)r   marker_sizerQ   s      r/   r    FancyArrowFactory.to_marker_edge  s>    X77<<K014477<<,q00r0   )r   r   r   r    r   r   r   r   r   r   r   r|   rz   rx   rw   r}   r   )arc3o-
   r8   N      ?solidr   r   N)
r   r   r   r   __doc__r   r   r   r   r   r6   r0   r/   r   r     sF    ?8( 8(D %4Rl_
B1r0   r   c                    SSK nSSKnSSKnSSKnSSKJn  SSKnUc-  U R                  5       =(       d    U R                  5       (       + nO'[        U[        5      (       d  [        S5      eU(       + n[        U[        5      (       a  U/nO:UR                  U5      (       a  [        U5      nOSn[        R                   " U5      eU(       a  SnUb$  UR#                  UR%                  S5      [&        SS9  US	:w  a$  UR#                  UR%                  S
5      [&        SS9  US:w  a$  UR#                  UR%                  S5      [&        SS9  US:w  a$  UR#                  UR%                  S5      [&        SS9  [)        S U 5       5      (       a$  UR#                  UR%                  S5      [&        SS9  Uc  U R                  5       (       a  SOSnUc  UR+                  5       nUc  [        U R,                  5      n[/        U5      (       ag  U R                  5       (       aB  [0        R2                  " S 5      nU Vs/ s H  n[5        U[7        USS 5         5      PM     nnOS/[/        U5      -  nO/ $ Uc  [        U R9                  5       5      nUc  SnUR;                  U Vs/ s H  nUUS      UUS      4PM     sn5      n UR                  U5      (       a  [/        U5      [/        U 5      :X  a  UR=                  U V!s/ s H  n![        U![>        5      PM     sn!5      (       a  U	b(  [        U	UR@                  RB                  5      (       d   eOURE                  5       n	U
c  [G        U5      n
Uc  [I        U5      nUR@                  RK                  XS9n"U Vs/ s H  nU	" U"" U5      5      PM     nnURM                  URO                  U SS2SS2S4   5      5      n#URQ                  URO                  U SS2SS2S4   5      5      n$URM                  URO                  U SS2SS2S4   5      5      n%URQ                  URO                  U SS2SS2S4   5      5      n&U$U#-
  n'U&U%-
  n(U(S:w  a  U(O!SURS                  U5      RI                  5       -  n)[U        U UUUUU)UUUUUUUUUUUS9n*U(       Ga
  UR0                  RW                  U UUSUUS9n+U+RY                  U	5        U+R[                  X5        U+R]                  S5        U+R_                  U5        URa                  U+5        U+n,[        Rb                  " U 5       V-s/ s H  n-U-U;   d  M  U-PM     n.n-U.(       a_  [        [e        [6        U5      5      n// n0U. H>  n-U/Rg                  U-5      n1U*" U15      n2U0Ri                  U25        URk                  U25        M@     OG/ n,[m        [/        U5      5       H-  n1U*" U15      n2URk                  U25        U,Ri                  U25        M/     SU'-  SU(-  n4n3U#U3-
  U%U4-
  4U$U3-   U&U4-   44n5URo                  U55        URq                  5         U(       a  URs                  SSSSSSS9  U,$ s  snf s  snf s  sn!f s  snf s  sn-f )a  Draw the edges of the graph G.

This draws only the edges of the graph G.

Parameters
----------
G : graph
    A networkx graph

pos : dictionary
    A dictionary with nodes as keys and positions as values.
    Positions should be sequences of length 2.

edgelist : collection of edge tuples (default=G.edges())
    Draw only specified edges

width : float or array of floats (default=1.0)
    Line width of edges

edge_color : color or array of colors (default='k')
    Edge color. Can be a single color or a sequence of colors with the same
    length as edgelist. Color can be string or rgb (or rgba) tuple of
    floats from 0-1. If numeric values are specified they will be
    mapped to colors using the edge_cmap and edge_vmin,edge_vmax parameters.

style : string or array of strings (default='solid')
    Edge line style e.g.: '-', '--', '-.', ':'
    or words like 'solid' or 'dashed'.
    Can be a single style or a sequence of styles with the same
    length as the edge list.
    If less styles than edges are given the styles will cycle.
    If more styles than edges are given the styles will be used sequentially
    and not be exhausted.
    Also, `(offset, onoffseq)` tuples can be used as style instead of a strings.
    (See `matplotlib.patches.FancyArrowPatch`: `linestyle`)

alpha : float or array of floats (default=None)
    The edge transparency.  This can be a single alpha value,
    in which case it will be applied to all specified edges. Otherwise,
    if it is an array, the elements of alpha will be applied to the colors
    in order (cycling through alpha multiple times if necessary).

edge_cmap : Matplotlib colormap, optional
    Colormap for mapping intensities of edges

edge_vmin,edge_vmax : floats, optional
    Minimum and maximum for edge colormap scaling

ax : Matplotlib Axes object, optional
    Draw the graph in the specified Matplotlib axes.

arrows : bool or None, optional (default=None)
    If `None`, directed graphs draw arrowheads with
    `~matplotlib.patches.FancyArrowPatch`, while undirected graphs draw edges
    via `~matplotlib.collections.LineCollection` for speed.
    If `True`, draw arrowheads with FancyArrowPatches (bendable and stylish).
    If `False`, draw edges using LineCollection (linear and fast).

    Note: Arrowheads will be the same color as edges.

arrowstyle : str or list of strs (default='-\|>' for directed graphs)
    For directed graphs and `arrows==True` defaults to '-\|>',
    For undirected graphs default to '-'.

    See `matplotlib.patches.ArrowStyle` for more options.

arrowsize : int or list of ints(default=10)
    For directed graphs, choose the size of the arrow head's length and
    width. See `matplotlib.patches.FancyArrowPatch` for attribute
    `mutation_scale` for more info.

connectionstyle : string or iterable of strings (default="arc3")
    Pass the connectionstyle parameter to create curved arc of rounding
    radius rad. For example, connectionstyle='arc3,rad=0.2'.
    See `matplotlib.patches.ConnectionStyle` and
    `matplotlib.patches.FancyArrowPatch` for more info.
    If Iterable, index indicates i'th edge key of MultiGraph

node_size : scalar or array (default=300)
    Size of nodes. Though the nodes are not drawn with this function, the
    node size is used in determining edge positioning.

nodelist : list, optional (default=G.nodes())
   This provides the node order for the `node_size` array (if it is an array).

node_shape :  string (default='o')
    The marker used for nodes, used in determining edge positioning.
    Specification is as a `matplotlib.markers` marker, e.g. one of 'so^>v<dph8'.

label : None or string
    Label for legend

min_source_margin : int or list of ints (default=0)
    The minimum margin (gap) at the beginning of the edge at the source.

min_target_margin : int or list of ints (default=0)
    The minimum margin (gap) at the end of the edge at the target.

hide_ticks : bool, optional
    Hide ticks of axes. When `True` (the default), ticks and ticklabels
    are removed from the axes. To set ticks and tick labels to the pyplot default,
    use ``hide_ticks=False``.

Returns
-------
 matplotlib.collections.LineCollection or a list of matplotlib.patches.FancyArrowPatch
    If ``arrows=True``, a list of FancyArrowPatches is returned.
    If ``arrows=False``, a LineCollection is returned.
    If ``arrows=None`` (the default), then a LineCollection is returned if
    `G` is undirected, otherwise returns a list of FancyArrowPatches.

Notes
-----
For directed graphs, arrows are drawn at the head end.  Arrows can be
turned off with keyword arrows=False or by passing an arrowstyle without
an arrow on the end.

Be sure to include `node_size` as a keyword argument; arrows are
drawn considering the size of nodes.

Self-loops are always drawn with `~matplotlib.patches.FancyArrowPatch`
regardless of the value of `arrows` or whether `G` is directed.
When ``arrows=False`` or ``arrows=None`` and `G` is undirected, the
FancyArrowPatches corresponding to the self-loops are not explicitly
returned. They should instead be accessed via the ``Axes.patches``
attribute (see examples).

Examples
--------
>>> G = nx.dodecahedral_graph()
>>> edges = nx.draw_networkx_edges(G, pos=nx.spring_layout(G))

>>> G = nx.DiGraph()
>>> G.add_edges_from([(1, 2), (1, 3), (2, 3)])
>>> arcs = nx.draw_networkx_edges(G, pos=nx.spring_layout(G))
>>> alphas = [0.3, 0.4, 0.5]
>>> for i, arc in enumerate(arcs):  # change alpha values of arcs
...     arc.set_alpha(alphas[i])

The FancyArrowPatches corresponding to self-loops are not always
returned, but can always be accessed via the ``patches`` attribute of the
`matplotlib.Axes` object.

>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> G = nx.Graph([(0, 1), (0, 0)])  # Self-loop at node 0
>>> edge_collection = nx.draw_networkx_edges(G, pos=nx.circular_layout(G), ax=ax)
>>> self_loop_fap = ax.patches[0]

Also see the NetworkX drawing examples at
https://networkx.org/documentation/latest/auto_examples/index.html

See Also
--------
draw
draw_networkx
draw_networkx_nodes
draw_networkx_labels
draw_networkx_edge_labels

r   Nz.Argument `arrows` must be of type bool or NonezAdraw_networkx_edges arg `connectionstyle` must be str or iterablea  

The {0} keyword argument is not applicable when drawing edges
with LineCollection.

To make this warning go away, either specify `arrows=True` to
force FancyArrowPatches or use the default values.
Note that using FancyArrowPatches may be slow for large graphs.
r   ra   )category
stacklevelr   r   r   r   c              3   *   #    U  H	  oS :g  v   M     g7f)r   Nr6   )r7   r   s     r/   r:   &draw_networkx_edges.<locals>.<genexpr>  s     6oV|os   r   z-|>r   c                  .    [         R                  " S5      $ r   	itertoolscountr6   r0   r/   <lambda>%draw_networkx_edges.<locals>.<lambda>  s    	8Jr0   r8   r   )rS   rT   {Gzt?r    )r   )r   rV   antialiasedsr   rU   g?rY   FrZ   ):warningsrc   rd   matplotlib.colorsr!   r"   re   is_directedis_multigraphrm   bool	TypeErrorr   r   rf   rC   rl   warnformatUserWarningr?   r'   edgesrg   rh   defaultdictnextr   nodesrj   r   r   r   Colormapget_cmapminr   	Normalizeaminravelamaxrp   r   LineCollectionset_cmapset_climrv   	set_labeladd_collectionselfloop_edgesmapr   append	add_patchrq   update_datalimautoscale_viewrt   )6r+   r   r   widthr   r   rU   r   r   	edge_cmap	edge_vmin	edge_vmaxr    r3   rX   rx   rw   rz   r   r   r   r{   r   r|   rc   r-   r}   use_linecollectionr   	key_counter   r   rP   color_normalminxmaxxminymaxyr   hr   fancy_arrow_factoryedge_collectionedge_viz_objloopselfloops_to_drawedgelist_tuplearrow_collectionr   arrowpadxpadycornerss6                                                         r/   r   r     s   r !# ~"#--/"FQ__5FG&$''LMM!'Z/3''*+	_	%	%/Qs##
 P 	 !MM#**\2[UVMW?MM#**[1KTUMV!MM

./+RS   !MM

./+RS   6o666MM

,-PQ  
 mmooU3
	zWWY=
8}}??#//0JKICKL8aD52A<!898LLL3X.L		? 
 zz8D8aC!Is1Q4y18DEH
 	J_H-FF:>:aJq&):>?? i)<)<====IJIJIzz+++K:DE*QiQ0*
E 77288HQ1W-./D77288HQ1W-./D77288HQ1W-./D77288HQ1W-./DtAtA
 6aurxx	/B/F/F/H'HO+#* //88 9 
 	  +  6""1%!!%(
/*& /1.?.?.BW.BddhFVT.BW!#eX"67N!)"((.+A. ''.U#	 * s8}%A'*ELL& & 4!8$Dd{D4K(4$;t*DDGg
 	 	
 k M E ? Fj Xs$   5$YY<Y$Y):
Y.Y.c                 l  ^^ SSK Jn  Uc  UR                  5       nTc!  U R                  5        Vs0 s H  oU_M     snm[	        5       mUU4S jnU4S jnU" US5        U" US5        U" US5        U" US5        U" US	5        0 nTR                  5        Hz  u  nnX   u  nn[        U[        5      (       d  [        U5      nUR                  UUUU" XS5      U" XS5      U" XS5      U" XS5      U" XS	5      U	U
UR                  UUS
9nUUU'   M|     U(       a  UR                  SSSSSSS9  U$ s  snf )a	  Draw node labels on the graph G.

Parameters
----------
G : graph
    A networkx graph

pos : dictionary
    A dictionary with nodes as keys and positions as values.
    Positions should be sequences of length 2.

labels : dictionary (default={n: n for n in G})
    Node labels in a dictionary of text labels keyed by node.
    Node-keys in labels should appear as keys in `pos`.
    If needed use: `{n:lab for n,lab in labels.items() if n in pos}`

font_size : int or dictionary of nodes to ints (default=12)
    Font size for text labels.

font_color : color or dictionary of nodes to colors (default='k' black)
    Font color string. Color can be string or rgb (or rgba) tuple of
    floats from 0-1.

font_weight : string or dictionary of nodes to strings (default='normal')
    Font weight.

font_family : string or dictionary of nodes to strings (default='sans-serif')
    Font family.

alpha : float or None or dictionary of nodes to floats (default=None)
    The text transparency.

bbox : Matplotlib bbox, (default is Matplotlib's ax.text default)
    Specify text box properties (e.g. shape, color etc.) for node labels.

horizontalalignment : string or array of strings (default='center')
    Horizontal alignment {'center', 'right', 'left'}. If an array is
    specified it must be the same length as `nodelist`.

verticalalignment : string (default='center')
    Vertical alignment {'center', 'top', 'bottom', 'baseline', 'center_baseline'}.
    If an array is specified it must be the same length as `nodelist`.

ax : Matplotlib Axes object, optional
    Draw the graph in the specified Matplotlib axes.

clip_on : bool (default=True)
    Turn on clipping of node labels at axis boundaries

hide_ticks : bool, optional
    Hide ticks of axes. When `True` (the default), ticks and ticklabels
    are removed from the axes. To set ticks and tick labels to the pyplot default,
    use ``hide_ticks=False``.

Returns
-------
dict
    `dict` of labels keyed on the nodes

Examples
--------
>>> G = nx.dodecahedral_graph()
>>> labels = nx.draw_networkx_labels(G, pos=nx.spring_layout(G))

Also see the NetworkX drawing examples at
https://networkx.org/documentation/latest/auto_examples/index.html

See Also
--------
draw
draw_networkx
draw_networkx_nodes
draw_networkx_edges
draw_networkx_edge_labels
r   Nc                    > [        U [        5      (       a8  [        U 5      [        T5      :w  a  [        U S35      eTR	                  U5        g g )Nz% must have the same length as labels.)rm   dictrg   rA   add)p_valuep_nameindividual_paramsr   s     r/   check_individual_params5draw_networkx_labels.<locals>.check_individual_params  sF    gt$$7|s6{* F8+P!QRR!!&) %r0   c                    > UT;   a  X   $ U$ r5   r6   )noder:  r;  r<  s      r/   get_param_value-draw_networkx_labels.<locals>.get_param_value  s    &&= r0   	font_size
font_colorfont_weightfont_familyrU   )
sizer   familyweightrU   horizontalalignmentverticalalignmentr   bboxclip_onrY   FrZ   )r!   r"   r'   r  setrB   rm   r   textr   rt   )r+   r   r   rC  rD  rF  rE  rU   rL  rJ  rK  r    rM  r{   r-   r   r=  rA  
text_itemsrX   r   r   tr<  s     `                    @r/   r   r   ;  s\   v $	zWWY~ !	*	1Q$	**
 I{3J5K7K7E7+JLLN5A%%%JEGG {;!!>"1=A"1=A!!G4 3/ll  
 
1' #* 
 	 	
 k +s   D1c                   ^0^1^2^3 SSK nSSKJm3  SSKm2 " U2U34S jSUR                  R
                  5      nU	c  SSSS.n	[        U[        5      (       a  U/nO8T2R                  U5      (       a  [        U5      nO[        R                  " S5      eUc  T3R                  5       nUcN  U R                  5       (       a  S	S
0O0 nU R                  " S!SS
0UD6 VVs0 s H  Gt nn[        U5      U_M     nnnU(       d  0 $ [!        UR#                  5       6 u  m0nUc  [        U R%                  5       5      nT2R'                  T0 Vs/ s H  nUUS      UUS      4PM     sn5      nU R                  5       (       aB  [(        R*                  " S 5      nT0 Vs/ s H  n[-        U[        USS 5         5      PM     nnOS/[/        T05      -  nSnU(       aY  T2R1                  T2R3                  USS2SS2S4   5      5      nT2R5                  T2R3                  USS2SS2S4   5      5      nUU-
  nUS:w  a  UO!ST2R7                  U5      R9                  5       -  n [;        UT0UUUU UUS9n!0 m1U0U14S jn"U14S jn#U"" US5        U"" US5        U"" US5        U"" US5        U"" U
S5        U"" US5        U"" US5        U"" US5        0 n$[=        [!        T0U5      5       GHv  u  n%u  nn&[        U&[        5      (       d  [        U&5      n&USS u  n'n(U!" U%5      n)U'U(:X  a  U)R?                  5       n*UR@                  RC                  UU'   5      n+U*" U+U+5      n,UR@                  RE                  5       RG                  U,5      n-U-RH                  S   u  n.n/UR	                  U.U/U&U#" US5      U#" US5      U#" US5      U#" US5      U#" US5      U#" U
S5      U#" US5      SUR@                  U	SUS9U$U'   GM  U" U)U&U#" US5      U#" US5      U#" US5      U#" US5      U#" US5      U#" U
S5      U#" US5      UR@                  U	SUU#" US5      U#" US5      (       + US9U$U'   GMy     U(       a  URK                  SSSSSSS 9  U$$ s  snnf s  snf s  snf )"a
  Draw edge labels.

Parameters
----------
G : graph
    A networkx graph

pos : dictionary
    A dictionary with nodes as keys and positions as values.
    Positions should be sequences of length 2.

edge_labels : dictionary (default=None)
    Edge labels in a dictionary of labels keyed by edge two-tuple.
    Only labels for the keys in the dictionary are drawn.

label_pos : float (default=0.5)
    Position of edge label along edge (0=head, 0.5=center, 1=tail)

font_size : int (default=10)
    Font size for text labels

font_color : color (default='k' black)
    Font color string. Color can be string or rgb (or rgba) tuple of
    floats from 0-1.

font_weight : string (default='normal')
    Font weight

font_family : string (default='sans-serif')
    Font family

alpha : float or None (default=None)
    The text transparency

bbox : Matplotlib bbox, optional
    Specify text box properties (e.g. shape, color etc.) for edge labels.
    Default is {boxstyle='round', ec=(1.0, 1.0, 1.0), fc=(1.0, 1.0, 1.0)}.

horizontalalignment : string (default='center')
    Horizontal alignment {'center', 'right', 'left'}

verticalalignment : string (default='center')
    Vertical alignment {'center', 'top', 'bottom', 'baseline', 'center_baseline'}

ax : Matplotlib Axes object, optional
    Draw the graph in the specified Matplotlib axes.

rotate : bool (default=True)
    Rotate edge labels to lie parallel to edges

clip_on : bool (default=True)
    Turn on clipping of edge labels at axis boundaries

node_size : scalar or array (default=300)
    Size of nodes.  If an array it must be the same length as nodelist.

nodelist : list, optional (default=G.nodes())
   This provides the node order for the `node_size` array (if it is an array).

connectionstyle : string or iterable of strings (default="arc3")
    Pass the connectionstyle parameter to create curved arc of rounding
    radius rad. For example, connectionstyle='arc3,rad=0.2'.
    See `matplotlib.patches.ConnectionStyle` and
    `matplotlib.patches.FancyArrowPatch` for more info.
    If Iterable, index indicates i'th edge key of MultiGraph

hide_ticks : bool, optional
    Hide ticks of axes. When `True` (the default), ticks and ticklabels
    are removed from the axes. To set ticks and tick labels to the pyplot default,
    use ``hide_ticks=False``.

Returns
-------
dict
    `dict` of labels keyed by edge

Examples
--------
>>> G = nx.dodecahedral_graph()
>>> edge_labels = nx.draw_networkx_edge_labels(G, pos=nx.spring_layout(G))

Also see the NetworkX drawing examples at
https://networkx.org/documentation/latest/auto_examples/index.html

See Also
--------
draw
draw_networkx
draw_networkx_nodes
draw_networkx_edges
draw_networkx_labels
r   Nc                   V   >^  \ rS rSrSSSS.U U4S jjrS rU4S jrU 4S	 jrS
rU =r	$ )2draw_networkx_edge_labels.<locals>.CurvedArrowTextiI  r   FN)	label_poslabels_horizontalr    c                D  > Xl         X l        X0l        Uc  TR                  5       nX@l        U R                  U5      u  U l        U l        U l        [        TU ](  " U R                  U R                  /UQ7SU R                  0UD6  U R                  R                  U 5        g )Nrotation)r2  rU  rV  r'   r    _update_text_pos_angler   r   anglesuperr   
add_artist)	r   r2  rU  rV  r    r   r   	__class__r-   s	          r/   r   ;draw_networkx_edge_labels.<locals>.CurvedArrowText.__init__J  s     J 'N%6"zWWYG)-)D)DU)K&DFDFDJ GTVVTVVRdRTZZR6RGGt$r0   c           	         UR                   nU R                  R                  nUR                  b  UR	                  UR                  S   5      nUR	                  UR                  S   5      nUR                  XE45      u  pEUR                  5       " UUUR                  UR                  UR                  U-  UR                  U-  S9nU$ UR                  UR                  5      nU$ )a  
This is part of FancyArrowPatch._get_path_in_displaycoord
It omits the second part of the method where path is converted
    to polygon based on width
The transform is taken from ax, not the object, as the object
    has not been added yet, and doesn't have transform
r   r   )patchApatchBr   r   )_dpi_corr    r   
_posA_posB_convert_xy_unitsr   get_connectionstyler`  ra  r   r   transform_path_path_original)r   r2  dpi_cor
trans_datar   r   _paths          r/   _get_arrow_path_dispGdraw_networkx_edge_labels.<locals>.CurvedArrowText._get_arrow_path_dispc  s     nnG**J+..u/?/?/BC..u/?/?/BC)33TLA113 << <<!MMG3!MMG3 L #11%2F2FGLr0   c                 L  > U R                  U5      nUR                  u  u  p4u  pVu  pxU R                  n	SU	-
  n
U
S-  U-  SU	-  U
-  U-  -   U	S-  U-  -   nU
S-  U-  SU	-  U
-  U-  -   U	S-  U-  -   nU R                  (       a  SnOdSU
-  XS-
  -  SU	-  Xu-
  -  -   nSU
-  Xd-
  -  SU	-  X-
  -  -   nTR	                  X5      STR
                  -  -  S-  nUS:  a  US-  nUS:  a  US-  nU R                  R                  R                  5       R                  X45      u  pXU4$ )Nr   ra   r   ih  Z      i)
rk  verticesrU  rV  arctan2pir    r   r   r   )r   r2  	path_dispr   r   cxcyr   r   rQ  ttr   r   rZ  change_xchange_yr}   s                   r/   rY  Idraw_networkx_edge_labels.<locals>.CurvedArrowText._update_text_pos_angle  sV   11%8I+4+=+=(HRhr AQBA
QURZ"_,q!tby8AA
QURZ"_,q!tby8A%% r6RW-A0AAr6RW-A0AAH71ruu9EL2:SLE3;SLEWW&&//1;;QFCFQ;r0   c                   > U R                  U R                  5      u  U l        U l        U l        U R                  U R                  U R                  45        U R                  U R                  5        [        TU ]!  U5        g r5   )	rY  r2  r   r   rZ  set_positionset_rotationr[  r   )r   rendererr]  s     r/   r   7draw_networkx_edge_labels.<locals>.CurvedArrowText.draw  s]    )-)D)DTZZ)P&DFDFDJtvvtvv./djj)GL"r0   )rZ  r2  r    rU  rV  r   r   )
r   r   r   r   r   rk  rY  r   r   __classcell__)r]  r}   r-   s   @r/   CurvedArrowTextrT  I  s,    
 #	% 	%2	8	4	# 	#r0   r  round)r   r   r   )boxstyleecfczNdraw_networkx_edges arg `connectionstyle` must bestring or iterable of stringsr>   Tdatar   c                  .    [         R                  " S5      $ r   r   r6   r0   r/   r   +draw_networkx_edge_labels.<locals>.<lambda>  s    IOOA4Fr0   ra   r   r   c                    > [        U [        5      (       a:  [        U 5      [        T5      :w  a  [        U S35      eU R	                  5       TU'   g g )Nz' must have the same length as edgelist.)rm   rf   rg   rA   iter)r:  r;  r   r<  s     r/   r=  :draw_networkx_edge_labels.<locals>.check_individual_params  sI    gt$$7|s8}, F8+R!STT(/f% %r0   c                 0   > UT;   a  [        TU   5      $ U $ r5   )r
  )r:  r;  r<  s     r/   rA  2draw_networkx_edge_labels.<locals>.get_param_value  s"    &&)&122r0   rC  rD  rE  rU   rJ  rK  rotaterU  rF  )rG  r   rH  rI  rU   rJ  rK  rX  r   rL  r   rM  )rG  r   rH  rI  rU   rJ  rK  r   rL  r   rM  rU  rV  r    rY   FrZ   r6   )&rc   r!   r"   re   rO  Textrm   r   r   rf   rC   rl   r'   r  r  r   ziprB   r  rj   rh   r	  r
  rg   r  r  r  rp   r   r   	enumeratere  r   r   r   rf  rp  rt   )4r+   r   edge_labelsrU  rC  rD  rF  rE  rU   rL  rJ  rK  r    r  rM  rx   rw   r   r{   r|   r  r,   edgedr   r$  r   r#  r   r*  r(  r)  r   r+  r=  rA  rP  r   rX   n1n2r2  connectionstyle_objr   rs  	path_datar   r   r   r<  r}   r-   s4                                                   @@@@r/   r   r     s   b #V# V##((-- V#r |#?/R/3''*+	_	%	%/,
 	

 
zWWY!"!2!2~67gg6P46P46PQ6P(4uT{A~6PQ	K--/0Hf	? zz8D8aC!Is1Q4y18DEH++,FG	?GHx!YuQrU|45xHsS]*
 	
AwwrxxAq 123wwrxxAq 1234K6aurxx	/B/F/F/H'HO+	 7
 I{3J5K7E7+/1FG-/BCFH-I{3J%c(F&;<=D%%%%JEbqB#A&8"'";";"=<<))#b'2D+D$7I--/>>yII%%a(DAq!ww$Y<%j,?&{MB&{MB%eW5$3')>% #2%':# ,,'  '  Jt,  /$Y<%j,?&{MB&{MB%eW5$3')>% #2%':# ,,))[A&5fh&G"G) JtE =r 
 	 	
 E R E Is   Q*Q0$Q5c                 0    [        U [        U 5      40 UD6  g)am  Draw the graph `G` with a circular layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.circular_layout(G), **kwargs)

Parameters
----------
G : graph
    A networkx graph

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Notes
-----
The layout is computed each time this function is called. For
repeated drawing it is much more efficient to call
`~networkx.drawing.layout.circular_layout` directly and reuse the result::

    >>> G = nx.complete_graph(5)
    >>> pos = nx.circular_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.path_graph(5)
>>> nx.draw_circular(G)

See Also
--------
:func:`~networkx.drawing.layout.circular_layout`
N)r   r   r+   r   s     r/   r   r   9  s    H 	OA)&)r0   c                 0    [        U [        U 5      40 UD6  g)a  Draw the graph `G` with a Kamada-Kawai force-directed layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.kamada_kawai_layout(G), **kwargs)

Parameters
----------
G : graph
    A networkx graph

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Notes
-----
The layout is computed each time this function is called.
For repeated drawing it is much more efficient to call
`~networkx.drawing.layout.kamada_kawai_layout` directly and reuse the
result::

    >>> G = nx.complete_graph(5)
    >>> pos = nx.kamada_kawai_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.path_graph(5)
>>> nx.draw_kamada_kawai(G)

See Also
--------
:func:`~networkx.drawing.layout.kamada_kawai_layout`
N)r   r   r  s     r/   r   r   `  s    J 	"-f-r0   c                 0    [        U [        U 5      40 UD6  g)ah  Draw the graph `G` with a random layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.random_layout(G), **kwargs)

Parameters
----------
G : graph
    A networkx graph

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Notes
-----
The layout is computed each time this function is called.
For repeated drawing it is much more efficient to call
`~networkx.drawing.layout.random_layout` directly and reuse the result::

    >>> G = nx.complete_graph(5)
    >>> pos = nx.random_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.lollipop_graph(4, 3)
>>> nx.draw_random(G)

See Also
--------
:func:`~networkx.drawing.layout.random_layout`
N)r   r   r  s     r/   r   r     s    H 	M!''r0   c                 0    [        U [        U 5      40 UD6  g)a  Draw the graph `G` with a spectral 2D layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.spectral_layout(G), **kwargs)

For more information about how node positions are determined, see
`~networkx.drawing.layout.spectral_layout`.

Parameters
----------
G : graph
    A networkx graph

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Notes
-----
The layout is computed each time this function is called.
For repeated drawing it is much more efficient to call
`~networkx.drawing.layout.spectral_layout` directly and reuse the result::

    >>> G = nx.complete_graph(5)
    >>> pos = nx.spectral_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.path_graph(5)
>>> nx.draw_spectral(G)

See Also
--------
:func:`~networkx.drawing.layout.spectral_layout`
N)r   r
   r  s     r/   r   r     s    N 	OA)&)r0   c                 0    [        U [        U 5      40 UD6  g)a  Draw the graph `G` with a spring layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.spring_layout(G), **kwargs)

Parameters
----------
G : graph
    A networkx graph

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Notes
-----
`~networkx.drawing.layout.spring_layout` is also the default layout for
`draw`, so this function is equivalent to `draw`.

The layout is computed each time this function is called.
For repeated drawing it is much more efficient to call
`~networkx.drawing.layout.spring_layout` directly and reuse the result::

    >>> G = nx.complete_graph(5)
    >>> pos = nx.spring_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.path_graph(20)
>>> nx.draw_spring(G)

See Also
--------
draw
:func:`~networkx.drawing.layout.spring_layout`
N)r   r   r  s     r/   r   r     s    P 	M!''r0   c                 ,    [        U [        XS940 UD6  g)a{  Draw networkx graph `G` with shell layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.shell_layout(G, nlist=nlist), **kwargs)

Parameters
----------
G : graph
    A networkx graph

nlist : list of list of nodes, optional
    A list containing lists of nodes representing the shells.
    Default is `None`, meaning all nodes are in a single shell.
    See `~networkx.drawing.layout.shell_layout` for details.

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Notes
-----
The layout is computed each time this function is called.
For repeated drawing it is much more efficient to call
`~networkx.drawing.layout.shell_layout` directly and reuse the result::

    >>> G = nx.complete_graph(5)
    >>> pos = nx.shell_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.path_graph(4)
>>> shells = [[0], [1, 2, 3]]
>>> nx.draw_shell(G, nlist=shells)

See Also
--------
:func:`~networkx.drawing.layout.shell_layout`
)nlistN)r   r	   )r+   r  r   s      r/   r   r     s    T 	L(3F3r0   c                 0    [        U [        U 5      40 UD6  g)a  Draw a planar networkx graph `G` with planar layout.

This is a convenience function equivalent to::

    nx.draw(G, pos=nx.planar_layout(G), **kwargs)

Parameters
----------
G : graph
    A planar networkx graph

kwargs : optional keywords
    See `draw_networkx` for a description of optional keywords.

Raises
------
NetworkXException
    When `G` is not planar

Notes
-----
The layout is computed each time this function is called.
For repeated drawing it is much more efficient to call
`~networkx.drawing.layout.planar_layout` directly and reuse the result::

    >>> G = nx.path_graph(5)
    >>> pos = nx.planar_layout(G)
    >>> nx.draw(G, pos=pos)  # Draw the original graph
    >>> # Draw a subgraph, reusing the same node positions
    >>> nx.draw(G.subgraph([0, 1, 2]), pos=pos, node_color="red")

Examples
--------
>>> G = nx.path_graph(4)
>>> nx.draw_planar(G)

See Also
--------
:func:`~networkx.drawing.layout.planar_layout`
N)r   r   r  s     r/   r   r   1  s    R 	M!''r0   c                 0    [        U [        U 5      40 UD6  g)a  Draw a networkx graph with forceatlas2 layout.

This is a convenience function equivalent to::

   nx.draw(G, pos=nx.forceatlas2_layout(G), **kwargs)

Parameters
----------
G : graph
   A networkx graph

kwargs : optional keywords
   See networkx.draw_networkx() for a description of optional keywords,
   with the exception of the pos parameter which is not used by this
   function.
N)r   r   r  s     r/   r   r   ]  s    " 	q!,V,r0   c           	         SSK JnJn  SSKnSSKn	SSKn	SSKn
[        U 5      [        U5      :X  aT  [        U S   [        5      (       a<  UR                  R                  US9nUR                  XE5        UR                  U 5      nO6 U
R                  UR                  R                   R                  U 5      /5      n [        U5      [        U5      :  d  UR$                  [        U5      :X  aA  U
R'                  U[        U5      S45      nUS   USS2S4'   US   USS2S4'   US	   USS2S
4'   [)        U" U" U5      [        U5      5      5      USS2S4'   U$ ! ["         aM    U
R                  U  Vs/ s H'  oR                  R                   R                  U5      PM)     Os  snf sn5      n Nf = f! [*         a    XSS2S4'    U$ f = f)a  Apply an alpha (or list of alphas) to the colors provided.

Parameters
----------

colors : color string or array of floats (default='r')
    Color of element. Can be a single color format string,
    or a sequence of colors with the same length as nodelist.
    If numeric values are specified they will be mapped to
    colors using the cmap and vmin,vmax parameters.  See
    matplotlib.scatter for more details.

alpha : float or array of floats
    Alpha values for elements. This can be a single alpha value, in
    which case it will be applied to all the elements of color. Otherwise,
    if it is an array, the elements of alpha will be applied to the colors
    in order (cycling through alpha multiple times if necessary).

elem_list : array of networkx objects
    The list of elements which are being colored. These could be nodes,
    edges or labels.

cmap : matplotlib colormap
    Color map for use if colors is a list of floats corresponding to points
    on a color mapping.

vmin, vmax : float
    Minimum and maximum values for normalizing colors if a colormap is used

Returns
-------

rgba_colors : numpy ndarray
    Array containing RGBA format values for each of the node colours.

r   )cycleisliceN)rR   r   )r   r   r   )r   r   )r   ra   ra      )r   r  r  rc   matplotlib.cmr   re   rg   rm   r   cmScalarMappabler  to_rgbarp   r   r   rA   rG  resizerf   r  )r   rU   	elem_listrR   rS   rT   r  r  r|   rc   r}   mapperrgba_colorsr   s                 r/   rn   rn   q  s   J ( 6{c)n$F1Iv)F)F&&D&1#nnV,
	((CJJ$=$=$E$Ef$M#NOK#
 u:K((K,<,<I,N))K#i.!1DEK!,T!2KA!,T!2KA!,T!2KA ec+6F!GHAqD %  	((GMNve**2259vNK	   #"ArE#s1   5E <BF2 F/1.F 
F/.F/2GG)NN)NNT)N,  z#1f78b4r   NNNNNNNNNT)Nr   r8   r   NNr   NNNNNNr  Nr   r   r   r   T)N   r8   
sans-serifnormalNNcenterr  NTT)Nr   r   r8   r  r  NNr  r  NTTr  Nr   Tr5   )NNN)!r   rh   r   numbersr   networkxrC   networkx.drawing.layoutr   r   r   r   r   r	   r
   r   __all__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rn   r6   r0   r/   <module>r     s_  &    	 	 	$K\z@ 
			
!gTX1 X1| 



-rp 
	 Vx 
	 'bJ$*N%.P$(N'*T((V*4Z)(X-(Jr0   