code: def test_graph_attributes():
      G = nx.path_graph(4)
      G.add_node(1, color="red")
      G.add_edge(1, 2, width=7)
      G.graph["foo"] = "bar"
      G.graph[1] = "one"
      G.add_node(3, name="node", id="123")
  
      H = cytoscape_graph(cytoscape_data(G))
      assert H.graph["foo"] == "bar"
      assert H.nodes[1]["color"] == "red"
      assert H[1][2]["width"] == 7
      assert H.nodes[3]["name"] == "node"
      assert H.nodes[3]["id"] == "123"
  
      d = json.dumps(cytoscape_data(G))
      H = cytoscape_graph(json.loads(d))
      assert H.graph["foo"] == "bar"
      assert H.graph[1] == "one"
      assert H.nodes[1]["color"] == "red"
      assert H[1][2]["width"] == 7
      assert H.nodes[3]["name"] == "node"
      assert H.nodes[3]["id"] == "123"
  
file_path: networkx/networkx/readwrite/json_graph/tests/test_cytoscape.py
imports: import copy
  import json
  import pytest
  import networkx
  from networkx.readwrite.json_graph import cytoscape_data, cytoscape_graph
label_desc: Use image node_id 3 for calling a global function with example usage: test_graph_attributes() without return types