
    Gd              
          d Z ddlmZmZ ddlZddlmZ ddlZ	d Z
 e
            Ze                    d          D ]&\  ZZZ ede de d	ed
         d                     ' e	j        edd          Z e	j        eeddddd            ej                    Ze                    d            ej                     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                     t          j        d          } t          j                    }| D ]}t	          |d                   \  }}|                    dg           }|                    dg           }|                    dg           }|                    dg           }t          ||z   |z   |z             }	|	D ]\  }
}|                    |||           |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_addrs               :share/doc/networkx-3.1/examples/drawing/plot_unix_email.py
mbox_graphr      s    <)**D
A  > >%.s6{%;%;"k kk$##kk$##[[b11
[[b11
%cCi*&<z&IJJ(6 	> 	>$KJJ{KJ====	> H    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show r   r   <module>r>      s3   & 0 / / / / / / /             , JLL wwDw!! C CGAq!	E
A1
A
A1
A
A)Y(?
A
ABBBBbqRc222 3!33"RV W W W WSWYY 

4    




r   