+
    �°³jî  ã                   óX   € ^ RI tRR.tRR lt]P                  ! RRR7      RR l4       tR# )	é    NÚ	tree_dataÚ
tree_graphc                óŽ  aaa€ V P                  4       V P                  4       ^,           8w  d   \        R4      hV P                  4       '       g   \        R4      h\        P
                  ! V 4      '       g   \        R4      hSS8X  d   \        P                  ! R4      hVVV3R lo/ V P                  V,          CSVSS! W4      /C# )ai  Returns data in tree format that is suitable for JSON serialization
and use in JavaScript documents.

Parameters
----------
G : NetworkX graph
   G must be an oriented tree

root : node
   The root of the tree

ident : string
    Attribute name for storing NetworkX-internal graph data. `ident` must
    have a different value than `children`. The default is 'id'.

children : string
    Attribute name for storing NetworkX-internal graph data. `children`
    must have a different value than `ident`. The default is 'children'.

Returns
-------
data : dict
   A dictionary with node-link formatted data.

Raises
------
NetworkXError
    If `children` and `ident` attributes are identical.

Examples
--------
>>> from networkx.readwrite import json_graph
>>> G = nx.DiGraph([(1, 2)])
>>> data = json_graph.tree_data(G, root=1)

To serialize with json

>>> import json
>>> s = json.dumps(data)

Notes
-----
Node attributes are stored in this format but keys
for attributes must be strings if you want to serialize with JSON.

Graph and edge attributes are not stored.

See Also
--------
tree_graph, node_link_data, adjacency_data
zG is not a tree.zG is not directed.zG is not weakly connected.z5The values for `id` and `children` must be different.c                 óÎ   <€ W,          p\        V4      ^ 8X  d   . # . pV FA  p/ VP                  V,          CS	V/CpS! WA4      pV'       d   WeS&   VP                  V4       KC  	  V# )r   )ÚlenÚnodesÚappend)
ÚnÚGÚnbrsÚ	children_ÚchildÚdÚcÚadd_childrenÚchildrenÚidents
   &&     €€€Úc/home/luca/screen-checking/.venv/lib/python3.14/site-packages/networkx/readwrite/json_graph/tree.pyr   Útree_data.<locals>.add_childrenD   sl   ø€ Ø�tˆÜˆt‹9˜Œ>ØˆIØˆ	ÛˆEØ0�1—7‘7˜5•>Ð0 5¨%Ñ0ˆAÙ˜UÓ&ˆAßØ�(‘Ø×Ñ˜QÖñ ð Ðó    )Únumber_of_nodesÚnumber_of_edgesÚ	TypeErrorÚis_directedÚnxÚis_weakly_connectedÚNetworkXErrorr   )r   Úrootr   r   r   s   &&ff@r   r   r      sª   ú€ ðh 	×ÑÓ˜a×/Ñ/Ó1°AÕ5Ô5ÜÐ*Ó+Ð+Ø�=‰=�?Š?ÜÐ,Ó-Ð-Ü×!Ò! !×$Ò$ÜÐ4Ó5Ð5à�ÔÜ×ÒÐVÓWÐW÷ð Kˆa�g‰g�d�mÐJ˜U D¨(±LÀÓ4IÑJÐJr   T)ÚgraphsÚreturns_graphc                ó@  aaaa	€ \         P                  ! 4       o	VVV	V3R loV S,          pV P                  S. 4      pV P                  4        UUu/ uF#  w  rVVS8w  g   K  VS8w  g   K  \	        V4      VbK%  	  pppS	P
                  ! V3/ VB  S! W44       S	# u uppi )aµ  Returns graph from tree data format.

Parameters
----------
data : dict
    Tree formatted graph data

ident : string
    Attribute name for storing NetworkX-internal graph data. `ident` must
    have a different value than `children`. The default is 'id'.

children : string
    Attribute name for storing NetworkX-internal graph data. `children`
    must have a different value than `ident`. The default is 'children'.

Returns
-------
G : NetworkX DiGraph

Examples
--------
>>> from networkx.readwrite import json_graph
>>> G = nx.DiGraph([(1, 2)])
>>> data = json_graph.tree_data(G, root=1)
>>> H = json_graph.tree_graph(data)

See Also
--------
tree_data, node_link_data, adjacency_data
c                 óB  <€ V F‘  pVS,          pS
P                  W4       VP                  S	. 4      pV'       d	   S! W44       VP                  4        UUu/ uF#  w  rVVS8w  g   K  VS	8w  g   K  \        V4      VbK%  	  pppS
P                  ! V3/ VB  K“  	  R # u uppi )N)Úadd_edgeÚgetÚitemsÚstrÚadd_node)Úparentr   Údatar   ÚgrandchildrenÚkÚvÚnodedatar   r   Úgraphr   s   &&      €€€€r   r   Ú tree_graph.<locals>.add_childrenv   s‘   ø€ ÛˆDØ˜•KˆEØ�N‰N˜6Ô)Ø ŸH™H X¨rÓ2ˆMßÙ˜UÔ2à&*§j¡j¤lôÙ&2™d˜a°a¸5±j”	ÀQÈ(Á]”	”�A“˜’	¡lð ñ ð �NŠN˜5Ñ- HÔ-ó ùós   ÁBÁ&BÁ/B)r   ÚDiGraphr$   r%   r&   r'   )
r)   r   r   r   r   r+   r,   r-   r   r.   s
   &ff     @@r   r   r   T   sŽ   û€ ô@ �JŠJ‹L€E÷
.ð 
.ð ��;€DØ—‘˜ 2Ó&€IØ&*§j¡j¤lÔS¡l™d˜a°a¸5±j”	ÀQÈ(Á]”	”�A“˜’	¡l€HÑSØ	‡N‚N�4Ñ$˜8Ò$Ù�Ô!Ø€Lùó Ts   ÁBÁ!BÁ*B)Úidr   )Únetworkxr   Ú__all__r   Ú_dispatchabler   © r   r   Ú<module>r6      s;   ðÛ à˜Ð
%€ôKKð\ ×Ò˜¨TÔ2ó2ó 3ò2r   