code: def test_approx_knn_graph():
      warnings.filterwarnings("ignore", ".*find n_neighbors.*")
  
      x = torch.tensor(
          [
              [-1.0, -1.0],
              [-1.0, +1.0],
              [+1.0, +1.0],
              [+1.0, -1.0],
          ]
      )
  
      edge_index = approx_knn_graph(x, k=2, flow="target_to_source")
      assert to_set(edge_index) == set(
          [
              (0, 1),
              (0, 3),
              (1, 0),
              (1, 2),
              (2, 1),
              (2, 3),
              (3, 0),
              (3, 2),
          ]
      )
  
      edge_index = approx_knn_graph(x, k=2, flow="source_to_target")
      assert to_set(edge_index) == set(
          [
              (1, 0),
              (3, 0),
              (0, 1),
              (2, 1),
              (1, 2),
              (3, 2),
              (0, 3),
              (2, 3),
          ]
      )
  
imports: import warnings
  import torch
  from torch_geometric.nn import approx_knn, approx_knn_graph
  from torch_geometric.testing import onlyFullTest, withPackage
label_desc: Use image node_id 3 for calling a global function with example usage: test_approx_knn_graph() without return types