U
    9%e                     @   s  d Z ddlmZ ddlZed e Zdddddd	gZ	d
ddgZ
dd e	e
 D Zdd e	D dd e
D  Zee	e
  edddddddddddddddg 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d0e ejjed.d1d2\ZZeeZeeZeD ]Zed3 ed4 q,ed-d.d. ed5e   d6d$d%d7d8d9d*d:d;d<	ZeeZ e !  e"e D ]\Z#Zd.e#d. fee< qe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/Darija-Ai-API/env/lib/python3.8/site-packages/../../../share/doc/networkx-3.1/examples/algorithms/plot_dedensification.py
<listcomp>   s     r   c                 C   s   g | ]}d qS )whiter   r   nr   r   r   r      s     c                 C   s   g | ]}d qS )redr   r   r   r   r   r      s     )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   T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copy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networkx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>   s   	


  

