The graph properties of r- and (r,s)-robustness are of importance for multiagent networks since these properties ensure consensus among agents even in the presence of a limited number of arbitrarily misbehaving agents, given sufficiently large values for the integers r and s. However, determining the exact solutions of r- and (r,s)-robustness of an arbitrary directed graph has been proven to be computationally complex NP-hard problem. In this paper, we introduce a novel method, named the Determining Robustness based Genetic Algorithm (DRSGA), for approximately calculating the r- and (r,s)-robustness using heuristic algorithm. According to graph theory in mathematical analysis, we first formalize the method for calculating the r- and (r,s)-robustness in directed graphs by utilizing a three-vertex set partition. Then, we transform these methods into a minimization problem of an n-dimensional discrete function and employ DRSGA to obtain an approximate solution. Finally, we validate the efficacy of our algorithm through a series of experiments compared to existing mixed-integer programming algorithms.