WCC with degree limitation

Hello,
I'm creating a device graph and right now I'm using the WCC model which does a great job, but sometimes it connects really far nodes (sometimes 40th degree and higher) and created huge clusters.
I was wondering if there's any way to limit the amount of degrees it's looking for so for example if 2 nodes are connected from a 5th degree or more it won't tie them together.
If it's not possible in WCC - is there any other model that gives me more control over that?
Thanks

Hello! A colleague recommended that the best answer is to use another algorithm. Leiden, Louvain, K-means (with node Embeddings), and perhaps LPA can be used and have some control , not directly over degree of separation, but of how granular the communities are. Hope this helps!