o
    ˷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   q%e	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 ];}t|d \}}|dg }|dg }|dg }|dg }t|| | | }	|	D ]\}
}|j|||d q9q|S )Nzunix_email.mboxFromtoccz	resent-toz	resent-cc)message)mailboxmboxnxMultiDiGraphr   get_allr   add_edge)r	   Gmsgsource_namesource_addrtosccs
resent_tos
resent_ccsall_recipientstarget_nametarget_addr r   y/var/www/ideatree/venv/lib/python3.10/site-packages/../../../share/doc/networkx-2.8.6/examples/drawing/plot_unix_email.py
mbox_graph   s   
r   T)datazFrom: z To: z
 Subject: r   Subject
      )
iterationsseedg?r   )	node_sizealpha
edge_color	font_sizewith_labelsg{Gz?)__doc__email.utilsr   r   r   matplotlib.pyplotpyplotpltnetworkxr
   r   r   edgesuvdprintspring_layoutposdrawgcaaxmarginsshowr   r   r   r   <module>   s    $
