From: Matthew Fernandez Date: Thu, 29 Dec 2022 19:55:39 +0000 (-0800) Subject: sfdpgen: remove unused 'maximal_independent_edge_set_heavest_edge_pernode_leaves_first' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fb817f9ab31ade94b6a9ec050c28c6cfc7a148e;p=graphviz sfdpgen: remove unused 'maximal_independent_edge_set_heavest_edge_pernode_leaves_first' --- diff --git a/lib/sfdpgen/Multilevel.c b/lib/sfdpgen/Multilevel.c index 53fb50eac..860df8b0d 100644 --- a/lib/sfdpgen/Multilevel.c +++ b/lib/sfdpgen/Multilevel.c @@ -242,114 +242,6 @@ static void maximal_independent_edge_set_heavest_edge_pernode(SparseMatrix A, in free(p); } - - - - -#define node_degree(i) (ia[(i)+1] - ia[(i)]) - -static void maximal_independent_edge_set_heavest_edge_pernode_leaves_first(SparseMatrix A, int **cluster, int **clusterp, int *ncluster){ - int i, ii, j, *ia, *ja, m, n, *p = NULL, q; - (void)n; - double *a, amax = 0; - int first = TRUE, jamax = 0; - int *matched, nz, ncmax = 0, nz0, nzz,k ; - enum {MATCHED = -1}; - - assert(A); - assert(SparseMatrix_known_strucural_symmetric(A)); - ia = A->ia; - ja = A->ja; - m = A->m; - n = A->n; - assert(n == m); - *cluster = gv_calloc(m, sizeof(int)); - *clusterp = gv_calloc(m + 1, sizeof(int)); - matched = gv_calloc(m, sizeof(int)); - - for (i = 0; i < m; i++) matched[i] = i; - - assert(SparseMatrix_is_symmetric(A, false)); - assert(A->type == MATRIX_TYPE_REAL); - - *ncluster = 0; - (*clusterp)[0] = 0; - nz = 0; - a = A->a; - p = random_permutation(m); - for (ii = 0; ii < m; ii++){ - i = p[ii]; - if (matched[i] == MATCHED || node_degree(i) != 1) continue; - q = ja[ia[i]]; - assert(matched[q] != MATCHED); - matched[q] = MATCHED; - (*cluster)[nz++] = q; - for (j = ia[q]; j < ia[q+1]; j++){ - if (q == ja[j]) continue; - if (node_degree(ja[j]) == 1){ - matched[ja[j]] = MATCHED; - (*cluster)[nz++] = ja[j]; - } - } - ncmax = MAX(ncmax, nz - (*clusterp)[*ncluster]); - nz0 = (*clusterp)[*ncluster]; - if (nz - nz0 <= MAX_CLUSTER_SIZE){ - (*clusterp)[++(*ncluster)] = nz; - } else { - (*clusterp)[++(*ncluster)] = ++nz0; - nzz = nz0; - for (k = nz0; k < nz && nzz < nz; k++){ - nzz += MAX_CLUSTER_SIZE - 1; - nzz = MIN(nz, nzz); - (*clusterp)[++(*ncluster)] = nzz; - } - } - } - - #ifdef DEBUG_print - if (Verbose) - fprintf(stderr, "%d leaves and parents for %d clusters, largest cluster = %d\n",nz, *ncluster, ncmax); -#endif - for (ii = 0; ii < m; ii++){ - i = p[ii]; - first = TRUE; - if (matched[i] == MATCHED) continue; - for (j = ia[i]; j < ia[i+1]; j++){ - if (i == ja[j]) continue; - if (matched[ja[j]] != MATCHED && matched[i] != MATCHED){ - if (first) { - amax = a[j]; - jamax = ja[j]; - first = FALSE; - } else { - if (a[j] > amax){ - amax = a[j]; - jamax = ja[j]; - } - } - } - } - if (!first){ - matched[jamax] = MATCHED; - matched[i] = MATCHED; - (*cluster)[nz++] = i; - (*cluster)[nz++] = jamax; - (*clusterp)[++(*ncluster)] = nz; - } - } - - for (i = 0; i < m; i++){ - if (matched[i] == i){ - (*cluster)[nz++] = i; - (*clusterp)[++(*ncluster)] = nz; - } - } - - free(p); - - free(matched); -} - static void maximal_independent_edge_set_heavest_edge_pernode_supernodes_first(SparseMatrix A, int **cluster, int **clusterp, int *ncluster){ int i, ii, j, *ia, *ja, m, n, *p = NULL; (void)n;