U
    ?h[  ã                	   @   sþ  d Z ddlmZ ddlZddlZddddœZdd„ e ¡ D ƒZ	e 
¡ Zejd	e	d	 d
 eddƒD ]RZejde› e	d d
 eddƒD ]*Zejdeeƒ d eeƒ e	d d
 qˆqbe d	d¡ e d	d¡ e d	d¡ eddƒD ]<ZeddƒD ],Ze deeƒ deeƒ d eeƒ ¡ qòqäejeddZe ¡ \ZZejeeeddddd ejjZej ¡ jZe  ¡ d e  ¡ d  d Z!e!d Z"ej#D ]^Z$eee$ ƒ\Z%Z&ee%e&fƒ\Z'Z(e )e'e" e(e" e!e!g¡Z*e* +ej#e$ d ¡ e* ,d¡ q’e -¡  dS )z¯
=================
Custom node icons
=================

Example of using custom icons to represent nodes with matplotlib.

Images for node icons courtesy of www.materialui.co
é    Nzicons/router_black_144x144.pngzicons/switch_black_144x144.pngz icons/computer_black_144x144.png)ÚrouterÚswitchÚPCc                 C   s   i | ]\}}|t j |¡“qS © )ÚPILZImageÚopen)Ú.0ÚkÚfnamer   r   úy/var/www/html/venv/lib/python3.8/site-packages/../../../share/doc/networkx-3.1/examples/drawing/plot_custom_node_icons.pyÚ
<dictcomp>   s      r   r   )Úimageé   é   Zswitch_r   ZPC_Ú_r   Zswitch_1Zswitch_2Zswitch_3iN'_g)ÚseedTú-é   )ÚposÚaxZarrowsZ
arrowstyleZmin_source_marginZmin_target_margingš™™™™™™?g       @r   Úoff).Ú__doc__Zmatplotlib.pyplotZpyplotZpltZnetworkxÚnxr   ZiconsÚitemsZimagesZGraphÚGÚadd_nodeÚrangeÚiÚjÚstrZadd_edgeÚuÚvZspring_layoutr   ZsubplotsZfigr   Zdraw_networkx_edgesZ	transDataZ	transformZ	tr_figureZtransFigureÚinvertedZtr_axesZget_xlimZ	icon_sizeZicon_centerZnodesÚnZxfZyfZxaZyaZaxesÚaZimshowZaxisÚshowr   r   r   r   Ú<module>   sT   
ý*,ù
