U
    ¹mœd  ã                	   @   s.  d Z ddlmZ ddlZddlm  mZ	 ddl
Z
ejdddd�Ze ed¡Zded< e ¡ ZeeeƒƒD ]dZeed	 eeƒƒD ]LZe
 ee d ee d  ee d	 ee d	  ¡ZeZejeeed
� q€qje	jedd
�Zeej e¡ƒZejeeddd� ejeededddd� e deƒ e !¡  dS )ac  
==========================
Traveling Salesman Problem
==========================

This is an example of a drawing solution of the traveling salesman problem

The function is used to produce the solution is christofides,
where given a set of nodes, it calculates the route of the nodes
that the traveler has to follow in order to minimize the total cost.
é    Né   gš™™™™™Ù?é   )ZradiusÚseedÚpos)ç      à?r   é   )Úweightr   Úbluer   )Ú
edge_colorÚwidthTÚredéÈ   )Zwith_labelsZedgelistr
   Z	node_sizer   zThe route of the traveller is:)"Ú__doc__Zmatplotlib.pyplotZpyplotZpltZnetworkxÚnxZ!networkx.algorithms.approximationZ
algorithmsZapproximationZnx_appÚmathZrandom_geometric_graphÚGZget_node_attributesr   ÚcopyÚHÚrangeÚlenÚiÚjÚhypotÚdistZadd_edgeZchristofidesÚcycleÚlistÚutilsÚpairwiseZ	edge_listZdraw_networkx_edgesZdraw_networkxÚprintÚshow© r    r    úr/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/../../../share/doc/networkx-3.1/examples/drawing/plot_tsp.pyÚ<module>   s6   4ù

