code: def test_map():
      pred_mat = torch.tensor([[1, 0], [1, 2], [0, 2]])
      edge_label_index = torch.tensor(
          [[0, 0, 0, 2, 2], [0, 1, 2, 2, 1]]
      )
  
      metric = LinkPredMAP(k=2)
      assert str(metric) == "LinkPredMAP(k=2)"
      metric.update(pred_mat, edge_label_index)
      result = metric.compute()
      assert float(result) == pytest.approx(0.6250)
  
file_path: pytorch_geometric/test/nn/test_metrics.py
imports: from typing import List
  import pytest
  import torch
  from torch_geometric.nn.metrics import LinkPredF1, LinkPredMAP, LinkPredNDCG, LinkPredPrecision, LinkPredRecall
label_desc: Use image node_id 4 for calling a global function with example usage: test_map() without return types