ó
    ô®i–  ã                   óF   • S r SSKrSSKJr  SSKJrJr  SS jrSS jrS r	g)	zg
altgraph.GraphUtil - Utility classes and functions
==================================================
é    N)Údeque)ÚGraphÚ
GraphErrorc                 óÊ  • [         R                   " 5       nU(       d#  U(       a  X -  nOX S-
  -  nX:”  a  [        S5      e[        U 5      nU H  nUR                  U5        M      [        R
                  " U5      n[        R
                  " U5      n	X‰:X  a	  U(       d  M;  UR                  X‰5      b	  U(       d  MV  UR                  X‰5        UR                  5       U:¼  a   U$ M  )z‚
Generates and returns a :py:class:`~altgraph.Graph.Graph` instance with
*node_num* nodes randomly connected by *edge_num* edges.
é   z1inconsistent arguments to 'generate_random_graph')	r   r   ÚrangeÚadd_nodeÚrandomÚchoiceÚedge_by_nodeÚadd_edgeÚnumber_of_edges)
Únode_numÚedge_numÚ
self_loopsÚmulti_edgesÚgÚ	max_edgesÚnodesÚnodeÚheadÚtails
             Ú?C:\des-py\RoboSAPF\venv\Lib\site-packages\altgraph\GraphUtil.pyÚgenerate_random_graphr      sÉ   € ô
 	�Š‹€AæÞØ Ñ+‰Ià ¨q¡LÑ1ˆIàÓÜÐPÓQÐQä�(‹O€EãˆØ	�
‰
�4Öñ ð Ü�}Š}˜UÓ#ˆÜ�}Š}˜UÓ#ˆð ‹<¦
Ùð �>‰>˜$Ó%Ñ1¾+Ùð 	
�
‰
�4ÔØ×ÑÓ (Ó*Øà€Hñ# ó    c                 óª  • [         R                   " 5       n/ n[        U5       HL  n[        US-   U5       H6  nUR                  U5        UR                  U5        UR                  Xg5        M8     MN     [        XU-  5       HÎ  nUR	                  U5        UR                  U5      U:  ak  [        R                  " U5      n	X‰:X  a	  U(       d  M9  UR                  X‰5      (       a	  U(       d  MX  UR                  X‰5        UR                  U5      U:  a  Mk  UR                  U5       H%  n	UR                  U5        UR                  U	5        M'     MÐ     U$ )a|  
Generates and returns a :py:class:`~altgraph.Graph.Graph` instance that
will have *steps* \* *growth_num* nodes and a scale free (powerlaw)
connectivity. Starting with a fully connected graph with *growth_num*
nodes at every step *growth_num* nodes are added to the graph and are
connected to existing nodes with a probability proportional to the degree
of these existing nodes.
r   )
r   r   Úappendr   r	   Ú
out_degreer
   r   r   Úout_nbrs)
ÚstepsÚ
growth_numr   r   ÚgraphÚstoreÚiÚjr   Únbrs
             r   Úgenerate_scale_free_graphr'   5   s  € ô �KŠK‹M€Eð €EÜ�:ÖˆÜ�q˜1‘u˜jÖ)ˆAØ�L‰L˜ŒOØ�L‰L˜ŒOØ�N‰N˜1Ö ó *ñ ô �j¨*Ñ"4Ö5ˆØ�‰�tÔØ×Ñ˜tÓ$ zÓ1Ü—-’- Ó&ˆCð ‹{¦:Ùð ×!Ñ! $×,Ñ,¶[Ùà�N‰N˜4Ô%ð ×Ñ˜tÓ$ zÕ1ð —>‘> $Ö'ˆCØ�L‰L˜ÔØ�L‰L˜Öó (ñ 6ð& €Lr   c                 óD  • U1[        5       [        5       pTn[        X4/5      nU R                  nU R                  nU R                  n	U(       a¨  UR                  5       u  p«U" U5      nUb+  U H#  nU" U5      (       a  M  UR                  U5          O   Un
U" U5       HK  nU	" U5      nX«La  UR                  X¯45        Xó;  d  M(  UR                  U5        UR                  X¯45        MM     U(       a  M¨  U VVs/ s H  u  nnUU;  d  M  UU4PM     nnnX4U4$ s  snnf )a”  
Perform a walk in a depth-first order starting
at *head*.

Returns (visited, removes, orphans).

* visited: the set of visited nodes
* removes: the list of nodes where the node
  data does not all *filters*
* orphans: tuples of (last_good, node),
  where node is not in removes, is directly
  reachable from a node in *removes* and
  *last_good* is the closest upstream node that is not
  in *removes*.
)Úsetr   Ú	node_dataÚ	out_edgesr   ÚpopÚaddr   )r"   r   ÚfiltersÚvisitedÚremovesÚorphansÚstackÚget_dataÚ	get_edgesÚget_tailÚ	last_goodr   ÚdataÚfiltfuncÚedger   ÚlgÚtls                     r   Úfilter_stackr<   `   s  € ð" "& ¬«¬s«u�g€GÜ�D�<�.Ó!€EØ�‰€HØ—‘€IØ�z‰z€Hæ
ØŸ)™)›+‰ˆ	Ù˜‹~ˆØÑÛ#�Ù —~“~Ø—K‘K Ô%Ùñ $ð
 !�	Ù˜d–OˆDÙ˜D“>ˆDØÒ$Ø—‘˜YÐ-Ô.ØÕ"Ø—‘˜DÔ!Ø—‘˜iÐ.Ö/ñ $÷ ˆ%ñ$ )0ÔEª™H˜R °2¸WÑ3D‹x��B‹x©€GÑEà˜WÐ$Ð$ùó Fs   Ã<DÄD)FF)
Ú__doc__r
   Úcollectionsr   Úaltgraphr   r   r   r'   r<   © r   r   Ú<module>rA      s&   ðñó
 Ý ç &ô&ôR(óV+%r   