This research article introduces a novel approach to enhance the accuracy of heart disease classification through the integration of graph-based techniques and community detection with machine learning. The paper explores the potential of capturing complex relationships within heart disease datasets using community detection and encode the membership of a node as a feature set, using on hot encoding, in order to enrich the current available features as the input of machine learning classifiers. The study utilizes a comprehensive dataset amalgamated from multiple sources and employs graph conversion, community detection, and machine learning algorithms to analyze the data. Results indicate that the proposed approach surpasses traditional machine learning models, achieving an accuracy of 94%. This study highlights the potential of graph-based methods to improve heart disease classification. It provides insights into opportunities, limitations, and areas for future research in this field. While there are certain limitations around sample size and challenges in real-world deployment, the research presents strong evidence supporting the effectiveness of community detection techniques for heart disease classification. The findings have implications for diagnosis and treatment.