From: Matthew Fernandez Date: Mon, 2 Jan 2023 00:14:33 +0000 (-0800) Subject: sparse Multilevel_Modularity_Clustering_init: rephrase 'deg_total' clamping X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=daf1967114682b1b9311648700e34d6465cb3f69;p=graphviz sparse Multilevel_Modularity_Clustering_init: rephrase 'deg_total' clamping Squashes a -Wfloat-equal warning. --- diff --git a/lib/sparse/clustering.c b/lib/sparse/clustering.c index 94902f136..c3cd6618c 100644 --- a/lib/sparse/clustering.c +++ b/lib/sparse/clustering.c @@ -9,6 +9,7 @@ *************************************************************************/ #define STANDALONE +#include #include #include #include @@ -58,7 +59,7 @@ static Multilevel_Modularity_Clustering Multilevel_Modularity_Clustering_init(Sp } deg_total += deg[i]; } - if (deg_total == 0) deg_total = 1; + deg_total = fmax(deg_total, 1); for (i = 0; i < n; i++){ modularity += (indeg[i] - deg[i]*deg[i]/deg_total)/deg_total; }