]> granicus.if.org Git - graphviz/commitdiff
topfish compute_densities: rephrase an open coded 'hypot'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Mar 2022 22:50:21 +0000 (14:50 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Mar 2022 07:33:29 +0000 (23:33 -0800)
lib/topfish/rescale_layout.c

index fe5165a6808ee3dfdd189dc4709b997a777f1d44..30c763e1fb64f07657e1adc6b4fa0005e553f8f9 100644 (file)
@@ -44,9 +44,7 @@ static double *compute_densities(v_data * graph, int n, double *x,
        sum = 0;
        for (j = 1; j < graph[i].nedges; j++) {
            neighbor = graph[i].edges[j];
-           sum +=
-               sqrt((x[i] - x[neighbor]) * (x[i] - x[neighbor]) +
-                    (y[i] - y[neighbor]) * (y[i] - y[neighbor]));
+           sum += hypot(x[i] - x[neighbor], y[i] - y[neighbor]);
        }
        densities[i] = sum / graph[i].nedges;
     }