def METHOD_NAME(
    edge_index: Adj,
    layer: int,
    num_sampled_src_nodes_per_hop: List[int],
    num_sampled_dst_nodes_per_hop: List[int],
    num_sampled_edges_per_hop: List[int],
) -> Adj:
    if layer <= 0:
        return edge_index
    if isinstance(edge_index, Tensor):
        return edge_index.narrow(
            dim=1,
            start=0,
            length=edge_index.size(1) - num_sampled_edges_per_hop[-layer],
        )
    elif isinstance(edge_index, SparseTensor):
        size = (
            edge_index.size(0) - num_sampled_dst_nodes_per_hop[-layer],
            edge_index.size(1) - num_sampled_src_nodes_per_hop[-layer],
        )
        num_seed_nodes = size[0] - num_sampled_dst_nodes_per_hop[-(layer + 1)]
        return trim_sparse_tensor(edge_index, size, num_seed_nodes)
    raise ValueError(f"Unsupported 'edge_index' type '{type(edge_index)}'")