How should I calculate the knn entropy using the leiden clusters?

Hello:

How should I calculate the knn entropy using the leiden clusters?
https://arxiv.org/pdf/1506.06501v1

Thanks a lot