code: def test_from_networkit(directed, weighted):
      import networkit
  
      g = networkit.Graph(3, weighted=weighted, directed=directed)
      g.addEdge(0, 1)
      g.addEdge(1, 2)
      if directed:
          g.addEdge(1, 0)
  
      if weighted:
          for i, (u, v) in enumerate(g.iterEdges()):
              g.setWeight(u, v, i + 1)
  
      edge_index, edge_weight = from_networkit(g)
  
      if directed:
          assert edge_index.tolist() == [[0, 1, 1], [1, 2, 0]]
          if weighted:
              assert edge_weight.tolist() == [1, 2, 3]
          else:
              assert edge_weight is None
      else:
          assert edge_index.tolist() == [[0, 1, 1, 2], [1, 0, 2, 1]]
          if weighted:
              assert edge_weight.tolist() == [1, 1, 2, 2]
          else:
              assert edge_weight is None
  
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 20 for calling a global function with example usage: test_from_networkit(directed, weighted) without return types