This function builds penalized K nearest neighbor graphs with rank The output is a list containing the graph and the degree distribution
P_Knear_rank(M, K = round(nrow(M)^0.8), lambda = 0.3)A list containing the truncated KNN graph (trun_KNN) and the degree distribution (degree)
A numeric matrix representing the distance matrix
An integer representing the number of neighbors to use
A numeric representing the penalty parameter
Zhu, Y., & Chen, H. (2023). A new robust graph for graph-based methods. arXiv preprint arXiv:2307.15205.