code: def test_to_networkit(directed, edge_weight, num_nodes):
      import networkit
  
      edge_index = torch.tensor(
          [[0, 1, 1], [1, 0, 2]], dtype=torch.long
      )
      g = to_networkit(edge_index, edge_weight, num_nodes, directed)
  
      assert isinstance(g, networkit.Graph)
      assert g.isDirected() == directed
      assert g.numberOfNodes() == 3
  
      if edge_weight is None:
          edge_weight = torch.tensor([1.0, 1.0, 1.0])
  
      assert g.weight(0, 1) == float(edge_weight[0])
      assert g.weight(1, 2) == float(edge_weight[2])
  
      if directed:
          assert g.numberOfEdges() == 3
          assert g.weight(1, 0) == float(edge_weight[1])
      else:
          assert g.numberOfEdges() == 2
  
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 19 for calling a global function with example usage: test_to_networkit(directed, edge_weight, num_nodes) without return types