]> granicus.if.org Git - graphviz/commitdiff
lib/topfish maxmatch: remove unused 'sum_weights'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 22 Mar 2022 01:43:47 +0000 (18:43 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Mar 2022 05:31:13 +0000 (22:31 -0700)
This causes compiler warnings resulting in build failure when enabling this in
the CMake build system.

Gitlab: related to #1836

lib/topfish/hierarchy.c

index 40a119f8da76340e25be143ab497534472a1860e..a276abebeefd7bd41910e85d4ca998df1f5935ca 100644 (file)
@@ -56,20 +56,17 @@ unweighted_common_fraction(v_data * graph, int v, int u, float *v_vector)
                                              num_shared_neighbors);
 }
 
-static float fill_neighbors_vec(v_data * graph, int vtx, float *vtx_vec)
-{
-    float sum_weights = 0;
+static void fill_neighbors_vec(v_data *graph, int vtx, float *vtx_vec) {
     int j;
     if (graph[0].ewgts != NULL) {
        for (j = 0; j < graph[vtx].nedges; j++) {
-           sum_weights += (vtx_vec[graph[vtx].edges[j]] = (float) fabs(graph[vtx].ewgts[j]));  // use fabs for the self loop
+           vtx_vec[graph[vtx].edges[j]] = (float) fabs(graph[vtx].ewgts[j]);   // use fabs for the self loop
        }
     } else {
        for (j = 0; j < graph[vtx].nedges; j++) {
-           sum_weights += (vtx_vec[graph[vtx].edges[j]] = 1);
+           vtx_vec[graph[vtx].edges[j]] = 1;
        }
     }
-    return sum_weights;
 }
 
 static void
@@ -163,7 +160,6 @@ maxmatch(v_data * graph,    /* array of vtx data for graph */
     int closest_neighbor;
     float *vtx_vec = N_NEW(nvtxs, float);
     float *weighted_vtx_vec = N_NEW(nvtxs, float);
-    float sum_weights;
 
     // gather statistics, to enable normalizing the values
     double avg_edge_len = 0, avg_deg_2 = 0;
@@ -247,7 +243,7 @@ maxmatch(v_data * graph,    /* array of vtx data for graph */
            continue;
        }
        inv_size = sqrt(1.0 / geom_graph[vtx].size);
-       sum_weights = fill_neighbors_vec(graph, vtx, weighted_vtx_vec);
+       fill_neighbors_vec(graph, vtx, weighted_vtx_vec);
        fill_neighbors_vec_unweighted(graph, vtx, vtx_vec);
        closest_neighbor = -1;