Clustering clients and conducting federated learning within clusters is an effective method to mitigate the poor perfor-mance of traditional federated learning algorithms in non-independently and identically distributed(Non-IID)data scenarios.Such methods primarily utilize the parameters of a client's local model to characterize data features,and evaluate similarity through the"distance"between parameters,thereby realizing client clustering.However,due to the permutation invariance of neurons in neu-ral networks,this could lead to inaccurate clustering results.Moreover,these methods typically require a predetermined number of clusters,which might result in unreasonable clusters,or they may require clustering during the algorithmic iterative process,lea-ding to substantial communication overhead.After in-depth analysis of the shortcomings of existing methods,a novel federated learning algorithm named FedRCD is proposed.This algorithm combines autoencoders and K-Means algorithms,directly extrac-ting distribution information from a client's dataset to represent its characteristics,thereby reducing reliance on model parame-ters.FedRCD also organizes the relationships between clients into a graph structure,and employs the Louvain algorithm to con-struct client clustering relationships.This process does not require pre-setting the number of clusters,which makes the clustering results more reasonable.Experimental results show that FedRCD can more effectively unearth latent clustering relationships be-tween clients.In a variety of Non-IID data scenarios,compared to other federated learning algorithms,it significantly improves the training effect of neural networks.On the CIFAR10 dataset,the accuracy of FedRCD surpasses the classical FedAvg algorithm by 37.08%,and even outperforms the newly released FeSEM algorithm by 1.89%,demonstrating superior fairness performance.