The coronavirus disease 2019 (COVID-19) was first reported in December 2019 in Wuhan, China, and then moved to almost every country showing an unprecedented outbreak. The world health organization declared COVID-19 a pandemic. Since then, millions of people were infected, and millions have lost their lives all around the globe. By the end of 2020, effective vaccines that could prevent the fast spread of the disease started to loom on the horizon. Nevertheless, isolation, social distancing, face masks, and quarantine are the best-known measures, in the time being, to fight the pandemic. On the other hand, contact tracing is an effective procedure in tracking infections and saving others' lives. In this paper, we devise a new approach using a hybrid harmony search (HHS) algorithm that casts the problem of finding strongly connected components (SCCs) to contact tracing. This new approach is named as hybrid harmony search contact tracing (HHS-CT) algorithm. The hybridization is achieved by integrating the stochastic hill climbing into the operators' design of the harmony search algorithm. The HHS-CT algorithm is compared to other existing algorithms of finding SCCs in directed graphs, where it showed its superiority over these algorithms. The devised approach provides a 77.18% enhancement in terms of run time and an exceptional average error rate of 1.7% compared to the other existing algorithms of finding SCCs.