a
    d                  
   @   s  d Z ddlmZ ddlZed e Zg dZ	g dZ
dd e	e
 D Zdd e	D d	d e
D  Zee	e
  eg d
 dddZdddddddddd	ZedddZede   ejefeede ejjeddd\ZZeeZeeZeD ]Zed ed qeddd ed e   d!ddd"d#d$dd%d&d'	ZeeZ e !  e"e D ]\Z#Zde#d fee< qtejefeeed(e e$  e%  dS ))a  
===============
Dedensification
===============

Examples of dedensification of a graph.  Dedensification retains the structural
pattern of the original graph and will only add compressor nodes when doing so
would result in fewer edges in the compressed graph.
    NZDedensification)123456)ABCc                 C   s   g | ]}d qS )    ).0noder   r   /var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/../../../share/doc/networkx-3.1/examples/algorithms/plot_dedensification.py
<listcomp>       r   c                 C   s   g | ]}d qS )Zwhiter   r   nr   r   r   r      r   c                 C   s   g | ]}d qS )Zredr   r   r   r   r   r      r   ))r   r
   )r   r	   )r   r
   )r   r	   )r   r   )r   r	   )r   r   )r   r   )r   r
   )r   r	   )r   r   )r   r	   )r   r   )r   r   )r   r   TZblack)Zwith_labelsZ
edgecolors)r      )r      )r      )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )	r   r   r   r   r   r	   r
   r   r   r   r   zOriginal (%s edges))pos
node_colorF)	thresholdcopyZyellowiX  zDedensified (%s edges))r   r   )r   g      ?)      ?r   )r   r   )r   r   )r   g      @)	r   r	   r   r   r   r   r
   r   r   )r   r   Z	node_size)&__doc__Zmatplotlib.pyplotZpyplotZpltZnetworkxZnxZsuptitleZDiGraphZoriginal_graphZwhite_nodesZ	red_nodesZ
node_sizesZnode_colorsZadd_nodes_fromZadd_edges_fromZbase_optionsr   ZsubplotZax1titleZnumber_of_edgesZdraw_networkxZsummarizationZ	dedensifyZnonexp_graphZcompression_nodeslistZnonexp_node_colorsZnonexp_node_sizesr   appendZ
nonexp_posZc_nodessort	enumerateZspotZtight_layoutshowr   r   r   r   <module>   sz   	



