U
    ª9%e¬  ã                	   @   s¾   d Z ddlmZmZ ddlZddlmZ ddlZ	dd„ Z
e
ƒ ZejddD ],\ZZZede› d	e› d
ed d › ƒ qJe	jedddZe	jeedddddd e ¡ Ze d¡ e ¡  dS )aO  
==========
Unix Email
==========

Create a directed graph, allowing multiple edges and self loops, from a unix
mailbox.  The nodes are email addresses with links that point from the sender
to the receivers.  The edge data is a Python email.Message object which
contains all of the email message data.

This example shows the power of `DiGraph` to hold edge data of arbitrary Python
objects (in this case a list of email messages).


The sample unix email mailbox called "unix_email.mbox" may be found here:

- https://github.com/networkx/networkx/blob/main/examples/drawing/unix_email.mbox
é    )ÚgetaddressesÚ	parseaddrNc                  C   s’   t  d¡} t ¡ }| D ]v}t|d ƒ\}}| dg ¡}| dg ¡}| dg ¡}| dg ¡}t|| | | ƒ}	|	D ]\}
}|j|||d qrq|S )Nzunix_email.mboxÚFromÚtoÚccz	resent-toz	resent-cc)Úmessage)ÚmailboxÚmboxÚnxZMultiDiGraphr   Úget_allr   Zadd_edge)r	   ÚGÚmsgZsource_nameZsource_addrZtosZccsZ
resent_tosZ
resent_ccsZall_recipientsZtarget_nameZtarget_addr© r   ú/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/../../../share/doc/networkx-3.1/examples/drawing/plot_unix_email.pyÚ
mbox_graph   s    
r   T)ÚdatazFrom: z To: z
 Subject: r   ÚSubjecté
   éã   )Z
iterationsÚseedgš™™™™™Ù?Úré   )Z	node_sizeÚalphaZ
edge_colorZ	font_sizeZwith_labelsg{®Gáz´?)Ú__doc__Úemail.utilsr   r   r   Zmatplotlib.pyplotZpyplotZpltZnetworkxr
   r   r   ÚedgesÚuÚvÚdÚprintZspring_layoutÚposZdrawZgcaZaxZmarginsÚshowr   r   r   r   Ú<module>   s   $
