]> granicus.if.org Git - graphviz/commitdiff
remove unused SparseMatrix_pseudo_diameter_weighted
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Jun 2021 04:48:29 +0000 (21:48 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 30 Jun 2021 03:24:10 +0000 (20:24 -0700)
lib/sparse/SparseMatrix.c
lib/sparse/SparseMatrix.h

index de44d9a3960ca1b94191675e9bebee4044feaf94..e4eba916bcf8ea66c14792603cc2d25af867ac7e 100644 (file)
@@ -2347,70 +2347,6 @@ static int Dijkstra_masked(SparseMatrix A, int root, real *dist, int *nlist, int
   return Dijkstra_internal(A, root, dist, nlist, list, dist_max, mask);
 }
 
-real SparseMatrix_pseudo_diameter_weighted(SparseMatrix A0, int root, int aggressive, int *end1, int *end2, int *connectedQ){
-  /* weighted graph. But still assume to be undirected. unsymmetric matrix ill be symmetrized */
-  SparseMatrix A = A0;
-  int m = A->m, i, *list = NULL, nlist;
-  int flag;
-  real *dist = NULL, dist_max = -1, dist0 = -1;
-  int roots[5], iroots, end11, end22;
-  if (!SparseMatrix_is_symmetric(A, TRUE)){
-    A = SparseMatrix_symmetrize(A, TRUE);
-  }
-  assert(m == A->n);
-
-  dist = MALLOC(sizeof(real)*((size_t)m));
-  list = MALLOC(sizeof(int)*((size_t)m));
-  nlist = 1;
-  list[nlist-1] = root;
-
-  assert(SparseMatrix_is_symmetric(A, TRUE));
-
-  do {
-    dist0 = dist_max;
-    root = list[nlist - 1];
-    flag = Dijkstra(A, root, dist, &nlist, list, &dist_max);
-    //fprintf(stderr,"after Dijkstra, {%d,%d}-%f\n",root, list[nlist-1], dist_max);
-    assert(dist[list[nlist-1]] == dist_max);
-    assert(root == list[0]);
-    assert(nlist > 0);
-  } while (dist_max > dist0);
-
-  *connectedQ = (!flag);
-  assert((dist_max - dist0)/MAX(1, MAX(fabs(dist0), fabs(dist_max))) < 1.e-10);
-
-  *end1 = root;
-  *end2 = list[nlist-1];
-  //fprintf(stderr,"after search for diameter, diam = %f, ends = {%d,%d}\n", dist_max, *end1, *end2);
-
-  if (aggressive){
-    iroots = 0;
-    for (i = MAX(0, nlist - 6); i < nlist - 1; i++){
-      roots[iroots++] = list[i];
-    }
-    for (i = 0; i < iroots; i++){
-      root = roots[i];
-      dist0 = dist_max;
-      fprintf(stderr,"search for diameter again from root=%d\n", root);
-      dist_max = SparseMatrix_pseudo_diameter_weighted(A, root, FALSE, &end11, &end22, connectedQ);
-      if (dist_max > dist0){
-       *end1 = end11; *end2 = end22;
-      } else {
-       dist_max = dist0;
-      }
-    }
-    fprintf(stderr,"after aggressive search for diameter, diam = %f, ends = {%d,%d}\n", dist_max, *end1, *end2);
-  }
-
-  FREE(dist);
-  FREE(list);
-
-  if (A != A0) SparseMatrix_delete(A);
-  return dist_max;
-
-}
-
 void SparseMatrix_decompose_to_supervariables(SparseMatrix A, int *ncluster, int **cluster, int **clusterp){
   /* nodes for a super variable if they share exactly the same neighbors. This is know as modules in graph theory.
      We work on columns only and columns with the same pattern are grouped as a super variable
index b8277277294f37f200bab15d5c7ddb4a0ec6092c..847229614337286857a578343885a24881c3245c 100644 (file)
@@ -87,7 +87,6 @@ SparseMatrix SparseMatrix_apply_fun(SparseMatrix A, double (*fun)(double x));/*
 SparseMatrix SparseMatrix_copy(SparseMatrix A);
 int SparseMatrix_has_diagonal(SparseMatrix A);
 SparseMatrix SparseMatrix_make_undirected(SparseMatrix A);/* make it strictly low diag only, and set flag to undirected */
-real SparseMatrix_pseudo_diameter_weighted(SparseMatrix A0, int root, int aggressive, int *end1, int *end2, int *connectedQ); /* assume real distances, unsymmetric matrix ill be symmetrized */
 void SparseMatrix_level_sets(SparseMatrix A, int root, int *nlevel, int **levelset_ptr, int **levelset, int **mask, int reintialize_mask);
 void SparseMatrix_level_sets_khops(int khops, SparseMatrix A, int root, int *nlevel, int **levelset_ptr, int **levelset, int **mask, int reintialize_mask);
 void SparseMatrix_weakly_connected_components(SparseMatrix A0, int *ncomp, int **comps, int **comps_ptr);