Ë
    D^(hÚ  ã                   óR   — d dl ZddgZdd„Z ej                  dd¬«      dd„«       Zy)	é    NÚcytoscape_dataÚcytoscape_graphc                 ó  — ||k(  rt        j                  d«      ‚dt        | j                  j	                  «       «      i}| j                  «       |d<   | j                  «       |d<   g g dœ|d<   |d   d   }|d   d   }| j                  j	                  «       D ]x  \  }}d|j                  «       i}|j                  |«      xs t        |«      |d   d	<   ||d   d
<   |j                  |«      xs t        |«      |d   d<   |j                  |«       Œz | j                  «       ry| j                  d¬«      D ]b  }	d| j                  |	d      |	d      |	d      j                  «       i}|	d   |d   d<   |	d   |d   d<   |	d   |d   d<   |j                  |«       Œd |S | j                  «       D ]Q  }	d| j                  |	d      |	d      j                  «       i}|	d   |d   d<   |	d   |d   d<   |j                  |«       ŒS |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
    --------
    >>> G = nx.path_graph(2)
    >>> nx.cytoscape_data(G)  # doctest: +SKIP
    {'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}}]}}
    ú!name and ident must be different.ÚdataÚdirectedÚ
multigraph)ÚnodesÚedgesÚelementsr
   r   ÚidÚvalueÚnameT)Ú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/skyplay_api_hub/venv/lib/python3.12/site-packages/networkx/readwrite/json_graph/cytoscape.pyr   r      s  € ðX ˆu‚}Ü×ÑÐBÓCÐCàœ˜QŸW™WŸ]™]›_Ó-Ð.€HØŸ=™=›?€HˆZÑØŸ_™_Ó.€Hˆ\ÑØ%'°"Ñ5€HˆZÑØ�ZÑ  Ñ)€EØ�ZÑ  Ñ)€Eà—‘—‘“ò ‰ˆˆ1Ø�Q—V‘V“XÐˆØŸ%™% ›,Ò0¬#¨a«&ˆˆ&‰	�$‰Øˆˆ&‰	�'ÑØŸE™E $›KÒ1¬3¨q«6ˆˆ&‰	�&ÑØ�‰�Q�ðð 	‡�ÔØ—‘˜d�Ó#ò 	ˆAØ˜Ÿ™˜q ™t™ Q q¡TÑ*¨1¨Q©4Ñ0×5Ñ5Ó7Ð8ˆAØ"# A¡$ˆAˆf‰I�hÑØ"# A¡$ˆAˆf‰I�hÑØ  ™tˆAˆf‰I�eÑØ�L‰L˜�Oð	ð €Oð —‘“ò 	ˆAØ˜Ÿ™˜q ™t™ Q q¡TÑ*×/Ñ/Ó1Ð2ˆAØ"# A¡$ˆAˆf‰I�hÑØ"# A¡$ˆAˆf‰I�hÑØ�L‰L˜�Oð		ð
 €Oó    T)ÚgraphsÚreturns_graphc                 óî  — ||k(  rt        j                  d«      ‚| j                  d«      }| j                  d«      }|rt        j                  «       }nt        j                  «       }|r|j                  «       }t        | j                  d«      «      |_        | d   d   D ]¢  }|d   j                  «       }|d   d   }|d   j                  |«      r|d   j                  |«      ||<   |d   j                  |«      r|d   j                  |«      ||<   |j                  |«       |j                  |   j                  |«       Œ¤ | d   d   D ]¤  }|d   j                  «       }	|d   d	   }
|d   d
   }|rK|d   j                  dd«      }|j                  |
||¬«       |j                  |
||f   j                  |	«       Œs|j                  |
|«       |j                  |
|f   j                  |	«       Œ¦ |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   S   sÝ  € ðx ˆu‚}Ü×ÑÐBÓCÐCà—‘˜,Ó'€JØ�x‰x˜
Ó#€HÙÜ—‘“‰ä—‘“
ˆÙØ×!Ñ!Ó#ˆÜ�t—x‘x Ó'Ó(€E„KØ�*Ñ˜gÑ&ò 
,ˆØ�f‘I—N‘NÓ$ˆ	Ø�‰y˜Ñ!ˆàˆV‰9�=‰=˜ÔØ ™iŸm™m¨DÓ1ˆI�d‰OØˆV‰9�=‰=˜ÔØ  ™yŸ}™}¨UÓ3ˆI�eÑà�‰�tÔØ�‰�DÑ× Ñ  Õ+ð
,ð �*Ñ˜gÑ&ò 
6ˆØ�f‘I—N‘NÓ$ˆ	Ø�‰y˜Ñ"ˆØ�‰y˜Ñ"ˆÙØ�F‘)—-‘-  qÓ)ˆCØ�N‰N˜4 ¨3ˆNÔ/Ø�K‰K˜˜d C˜Ñ(×/Ñ/°	Õ:à�N‰N˜4 Ô&Ø�K‰K˜˜d˜
Ñ#×*Ñ*¨9Õ5ð
6ð €Lr*   )r   r   )Únetworkxr   Ú__all__r   Ú_dispatchabler   © r*   r)   ú<module>r?      s?   ðÛ àÐ.Ð
/€óJðZ €×Ñ˜¨TÔ2ò^ó 3ñ^r*   