code: def test_lightgcn_ranking(
      embedding_dim, with_edge_weight, lambda_reg, alpha
  ):
      num_nodes = 500
      num_edges = 400
      edge_index = torch.randint(0, num_nodes, (2, num_edges))
      edge_weight = torch.rand(num_edges) if with_edge_weight else None
      edge_label_index = torch.randint(0, num_nodes, (2, 100))
  
      model = LightGCN(
          num_nodes, embedding_dim, num_layers=2, alpha=alpha
      )
      assert (
          str(model) == f"LightGCN(500, {embedding_dim}, num_layers=2)"
      )
  
      pred = model(edge_index, edge_label_index, edge_weight)
      assert pred.size() == (100,)
  
      loss = model.recommendation_loss(
          pos_edge_rank=pred[:50],
          neg_edge_rank=pred[50:],
          node_id=edge_index.unique(),
          lambda_reg=lambda_reg,
      )
      assert loss.dim() == 0 and loss > 0
  
      out = model.recommend(edge_index, edge_weight, k=2)
      assert out.size() == (500, 2)
      assert out.min() >= 0 and out.max() < 500
  
      src_index = torch.arange(0, 250)
      dst_index = torch.arange(250, 500)
  
      out = model.recommend(
          edge_index, edge_weight, src_index, dst_index, k=2
      )
      assert out.size() == (250, 2)
      assert out.min() >= 250 and out.max() < 500
  
imports: import pytest
  import torch
  from torch_geometric.nn.models import LightGCN
label_desc: Use image node_id 1 for calling a global function with example usage: test_lightgcn_ranking(embedding_dim, with_edge_weight, lambda_reg, alpha) without return types