From: Matthew Fernandez Date: Mon, 31 May 2021 16:46:45 +0000 (-0700) Subject: remove unused SparseMatrix_largest_component X-Git-Tag: 2.47.3~10^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a4b9f534906b5a2c9921479cb92847cd211c916b;p=graphviz remove unused SparseMatrix_largest_component --- diff --git a/lib/sparse/SparseMatrix.c b/lib/sparse/SparseMatrix.c index ba6c57fb7..73971cb75 100644 --- a/lib/sparse/SparseMatrix.c +++ b/lib/sparse/SparseMatrix.c @@ -2818,36 +2818,6 @@ SparseMatrix SparseMatrix_get_submatrix(SparseMatrix A, int nrow, int ncol, int } -SparseMatrix SparseMatrix_largest_component(SparseMatrix A){ - SparseMatrix B; - int ncomp; - int *comps = NULL; - int *comps_ptr = NULL; - int i; - int nmax, imax = 0; - - if (!A) return NULL; - A = SparseMatrix_to_square_matrix(A, BIPARTITE_RECT); - SparseMatrix_weakly_connected_components(A, &ncomp, &comps, &comps_ptr); - if (ncomp == 1) { - B = A; - } else { - nmax = 0; - for (i = 0; i < ncomp; i++){ - if (nmax < comps_ptr[i+1] - comps_ptr[i]){ - nmax = comps_ptr[i+1] - comps_ptr[i]; - imax = i; - } - } - B = SparseMatrix_get_submatrix(A, nmax, nmax, &comps[comps_ptr[imax]], &comps[comps_ptr[imax]]); - } - FREE(comps); - FREE(comps_ptr); - return B; - - -} - SparseMatrix SparseMatrix_delete_sparse_columns(SparseMatrix A, int threshold, int **new2old, int *nnew, int inplace){ /* delete sparse columns of threshold or less entries in A. After than number of columns will be nnew, and the mapping from new matrix column to old matrix column is new2old. diff --git a/lib/sparse/SparseMatrix.h b/lib/sparse/SparseMatrix.h index 999c08689..ba5a64fa9 100644 --- a/lib/sparse/SparseMatrix.h +++ b/lib/sparse/SparseMatrix.h @@ -106,8 +106,6 @@ SparseMatrix SparseMatrix_get_augmented(SparseMatrix A); */ SparseMatrix SparseMatrix_to_square_matrix(SparseMatrix A, int bipartite_options); -SparseMatrix SparseMatrix_largest_component(SparseMatrix A); - /* columns with <= threhold entries are deleted */ SparseMatrix SparseMatrix_delete_empty_columns(SparseMatrix A, int **new2old, int *nnew, int inplace); SparseMatrix SparseMatrix_delete_sparse_columns(SparseMatrix A, int threshold, int **new2old, int *nnew, int inplace);