U
    md                  	   @   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   y/home/sam/Atlas/atlas_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{Gz?)__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   $
