code: def test_from_networkx():
      x = torch.randn(2, 8)
      pos = torch.randn(2, 3)
      edge_index = torch.tensor([[0, 1, 0], [1, 0, 0]])
      edge_attr = torch.randn(edge_index.size(1))
      perm = torch.tensor([0, 2, 1])
      data = Data(
          x=x, pos=pos, edge_index=edge_index, edge_attr=edge_attr
      )
      G = to_networkx(
          data, node_attrs=["x", "pos"], edge_attrs=["edge_attr"]
      )
      data = from_networkx(G)
      assert len(data) == 4
      assert data.x.tolist() == x.tolist()
      assert data.pos.tolist() == pos.tolist()
      assert data.edge_index.tolist() == edge_index[:, perm].tolist()
      assert data.edge_attr.tolist() == edge_attr[perm].tolist()
  
imports: import pytest
  import scipy.sparse
  import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.testing import get_random_edge_index, withPackage
  from torch_geometric.utils import from_cugraph, from_dgl, from_networkit, from_networkx, from_scipy_sparse_matrix, from_trimesh, sort_edge_index, subgraph, to_cugraph, to_dgl, to_networkit, to_networkx, to_scipy_sparse_matrix, to_trimesh
label_desc: Use image node_id 8 for calling a global function with example usage: test_from_networkx() without return types