§
    bŠtjÑ  ã                   óV   — d dl ZddgZd
d„Z ej        dd¬¦  «        d
d	„¦   «         ZdS )é    NÚcytoscape_dataÚcytoscape_graphÚnameÚidc                 óø  — ||k    rt          j        d¦  «        ‚dt          | j                             ¦   «         ¦  «        i}|                      ¦   «         |d<   |                      ¦   «         |d<   g g dœ|d<   |d         d         }|d         d         }| j                             ¦   «         D ]•\  }}d|                     ¦   «         i}| 	                    |¦  «        pt          |¦  «        |d         d	<   ||d         d
<   | 	                    |¦  «        pt          |¦  «        |d         d<   |                     |¦  «         Œ–|                      ¦   «         r¡|                      d¬¦  «        D ]‰}	d| j        |	d                  |	d                  |	d                                       ¦   «         i}|	d         |d         d<   |	d         |d         d<   |	d         |d         d<   |                     |¦  «         ŒŠn�|                      ¦   «         D ]l}	d| j        |	d                  |	d                                       ¦   «         i}|	d         |d         d<   |	d         |d         d<   |                     |¦  «         Œm|S )a¨  Returns data in Cytoscape JSON format (cyjs).

    Parameters
    ----------
    G : NetworkX Graph
        The graph to convert to cytoscape format
    name : string
        A string which is mapped to the 'name' node element in cyjs format.
        Must not have the same value as `ident`.
    ident : string
        A string which is mapped to the 'id' node element in cyjs format.
        Must not have the same value as `name`.

    Returns
    -------
    data: dict
        A dictionary with cyjs formatted data.

    Raises
    ------
    NetworkXError
        If the values for `name` and `ident` are identical.

    See Also
    --------
    cytoscape_graph: convert a dictionary in cyjs format to a graph

    References
    ----------
    .. [1] Cytoscape user's manual:
       http://manual.cytoscape.org/en/stable/index.html

    Examples
    --------
    >>> from pprint import pprint
    >>> G = nx.path_graph(2)
    >>> cyto_data = nx.cytoscape_data(G)
    >>> pprint(cyto_data, sort_dicts=False)
    {'data': [],
     'directed': False,
     'multigraph': False,
     'elements': {'nodes': [{'data': {'id': '0', 'value': 0, 'name': '0'}},
                            {'data': {'id': '1', 'value': 1, 'name': '1'}}],
                  'edges': [{'data': {'source': 0, 'target': 1}}]}}

    The :mod:`json` package can be used to serialize the resulting data

    >>> import io, json
    >>> with io.StringIO() as fh:  # replace io with `open(...)` to write to disk
    ...     json.dump(cyto_data, fh)
    ...     fh.seek(0)  # doctest: +SKIP
    ...     print(fh.getvalue()[:64])  # View the first 64 characters
    {"data": [], "directed": false, "multigraph": false, "elements":

    ú!name and ident must be different.ÚdataÚdirectedÚ
multigraph)ÚnodesÚedgesÚelementsr   r   r   Úvaluer   T)Úkeysr   é   é   ÚsourceÚtargetÚkey)ÚnxÚNetworkXErrorÚlistÚgraphÚitemsÚis_directedÚis_multigraphr   ÚcopyÚgetÚstrÚappendr   Úadj)
ÚGr   ÚidentÚjsondatar   r   ÚiÚjÚnÚes
             úe/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/networkx/readwrite/json_graph/cytoscape.pyr   r      sN  € ðp ˆu‚}€}ÝÔÐBÑCÔCÐCà�˜QœWŸ]š]™_œ_Ñ-Ô-Ð.€HØŸ=š=™?œ?€HˆZÑØŸ_š_Ñ.Ô.€Hˆ\ÑØ%'°"Ð5Ð5€HˆZÑØ�ZÔ  Ô)€EØ�ZÔ  Ô)€Eà”—’‘”ð ð ‰ˆˆ1Ø�Q—V’V‘X”XÐˆØŸ%š% ™,œ,Ð0­#¨a©&¬&ˆˆ&Œ	�$‰Øˆˆ&Œ	�'ÑØŸEšE $™KœKÐ1­3¨q©6¬6ˆˆ&Œ	�&ÑØ�Š�Q‰Œˆˆà‡‚ÑÔð Ø—’˜d�Ñ#Ô#ð 	ð 	ˆAØ˜œ˜q œtœ Q q¤TÔ*¨1¨Q¬4Ô0×5Ò5Ñ7Ô7Ð8ˆAØ"# A¤$ˆAˆfŒI�hÑØ"# A¤$ˆAˆfŒI�hÑØ  œtˆAˆfŒI�eÑØ�LŠL˜‰OŒOˆOˆOð	ð —’‘”ð 	ð 	ˆAØ˜œ˜q œtœ Q q¤TÔ*×/Ò/Ñ1Ô1Ð2ˆAØ"# A¤$ˆAˆfŒI�hÑØ"# A¤$ˆAˆfŒI�hÑØ�LŠL˜‰OŒOˆOˆOØ€Oó    T)ÚgraphsÚreturns_graphc                 óÌ  — ||k    rt          j        d¦  «        ‚|                      d¦  «        }|                      d¦  «        }|rt          j        ¦   «         }nt          j        ¦   «         }|r|                     ¦   «         }t          |                      d¦  «        ¦  «        |_        | d         d         D ]Ñ}|d                              ¦   «         }|d         d         }|d                              |¦  «        r|d                              |¦  «        ||<   |d                              |¦  «        r|d                              |¦  «        ||<   | 	                    |¦  «         |j
        |                              |¦  «         ŒÒ| d         d         D ]Ê}|d                              ¦   «         }	|d         d	         }
|d         d
         }|rX|d                              dd¦  «        }|                     |
||¬¦  «         |j        |
||f                              |	¦  «         Œ’|                     |
|¦  «         |j        |
|f                              |	¦  «         ŒË|S )a�  
    Create a NetworkX graph from a dictionary in cytoscape JSON format.

    Parameters
    ----------
    data : dict
        A dictionary of data conforming to cytoscape JSON format.
    name : string
        A string which is mapped to the 'name' node element in cyjs format.
        Must not have the same value as `ident`.
    ident : string
        A string which is mapped to the 'id' node element in cyjs format.
        Must not have the same value as `name`.

    Returns
    -------
    graph : a NetworkX graph instance
        The `graph` can be an instance of `Graph`, `DiGraph`, `MultiGraph`, or
        `MultiDiGraph` depending on the input data.

    Raises
    ------
    NetworkXError
        If the `name` and `ident` attributes are identical.

    See Also
    --------
    cytoscape_data: convert a NetworkX graph to a dict in cyjs format

    References
    ----------
    .. [1] Cytoscape user's manual:
       http://manual.cytoscape.org/en/stable/index.html

    Examples
    --------
    >>> data_dict = {
    ...     "data": [],
    ...     "directed": False,
    ...     "multigraph": False,
    ...     "elements": {
    ...         "nodes": [
    ...             {"data": {"id": "0", "value": 0, "name": "0"}},
    ...             {"data": {"id": "1", "value": 1, "name": "1"}},
    ...         ],
    ...         "edges": [{"data": {"source": 0, "target": 1}}],
    ...     },
    ... }
    >>> G = nx.cytoscape_graph(data_dict)
    >>> G.name
    ''
    >>> G.nodes()
    NodeView((0, 1))
    >>> G.nodes(data=True)[0]
    {'id': '0', 'value': 0, 'name': '0'}
    >>> G.edges(data=True)
    EdgeDataView([(0, 1, {'source': 0, 'target': 1})])
    r   r   r
   r	   r   r   r   r   r   r   r   r   )r   )r   r   r   Ú
MultiGraphÚGraphÚto_directedÚdictr   r   Úadd_noder   ÚupdateÚadd_edger   )r	   r   r#   r   r
   r   ÚdÚ	node_dataÚnodeÚ	edge_dataÚsourÚtargr   s                r)   r   r   _   sA  € ðx ˆu‚}€}ÝÔÐBÑCÔCÐCà—’˜,Ñ'Ô'€JØ�xŠx˜
Ñ#Ô#€HØð Ý”‘”ˆˆå”‘
”
ˆØð $Ø×!Ò!Ñ#Ô#ˆÝ�t—x’x Ñ'Ô'Ñ(Ô(€E„KØ�*Ô˜gÔ&ð 
,ð 
,ˆØ�f”I—N’NÑ$Ô$ˆ	Ø�Œy˜Ô!ˆàˆVŒ9�=Š=˜ÑÔð 	2Ø œiŸmšm¨DÑ1Ô1ˆI�d‰OØˆVŒ9�=Š=˜ÑÔð 	4Ø  œyŸ}š}¨UÑ3Ô3ˆI�eÑà�Š�tÑÔÐØŒ�DÔ× Ò  Ñ+Ô+Ð+Ð+à�*Ô˜gÔ&ð 
6ð 
6ˆØ�f”I—N’NÑ$Ô$ˆ	Ø�Œy˜Ô"ˆØ�Œy˜Ô"ˆØð 	6Ø�F”)—-’-  qÑ)Ô)ˆCØ�NŠN˜4 ¨3ˆNÑ/Ô/Ð/ØŒK˜˜d C˜Ô(×/Ò/°	Ñ:Ô:Ð:Ð:à�NŠN˜4 Ñ&Ô&Ð&ØŒK˜˜d˜
Ô#×*Ò*¨9Ñ5Ô5Ð5Ð5Ø€Lr*   )r   r   )Únetworkxr   Ú__all__r   Ú_dispatchabler   © r*   r)   ú<module>r?      sx   ðØ Ð Ð Ð àÐ.Ð
/€ðVð Vð Vð Vðr €Ô˜¨TÐ2Ñ2Ô2ð^ð ^ð ^ñ 3Ô2ð^ð ^ð ^r*   