remove unused makeDotGraph
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 19 Jun 2021 20:50:25 +0000 (13:50 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Jun 2021 02:28:08 +0000 (19:28 -0700)
lib/sparse/DotIO.c
lib/sparse/DotIO.h

index 44728935746bb4281a909a590c0acab4c2359d43..71af6b5b9c365dfab7a6c16e758b3860acde8ab5 100644 (file)
@@ -347,176 +347,6 @@ void dump_coordinates(char *name, int n, int dim, real *x){
 
 }
 
-static Agnode_t*
-mkNode (Agraph_t* g, char* name)
-{
-  Agnode_t* n = agnode(g, name, 1);
-  agbindrec(n, "info", sizeof(Agnodeinfo_t), TRUE);
-  return n;
-}
-
-Agraph_t* 
-makeDotGraph (SparseMatrix A, char *name, int dim, real *x, int with_color, int with_label, int  use_matrix_value)
-{
-  Agraph_t* g;
-  Agnode_t* n;
-  Agnode_t* h;
-  Agedge_t* e;
-  int i, j;
-  char buf2[1024];
-  Agsym_t *sym2 = NULL, *sym3 = NULL;
-  int* ia=A->ia;
-  int* ja=A->ja;
-  real* val = (real*)(A->a);
-  Agnode_t** arr = N_NEW (A->m, Agnode_t*);
-  real *color = NULL;
-  char cstring[8];
-  char label_string[1000];
-
-  if (!name){
-    name = "stdin";
-  } else {
-    name = strip_dir(name);
-  }
-
-  if (SparseMatrix_known_undirected(A)){
-    g = agopen ("G", Agundirected, 0);
-  } else {
-    g = agopen ("G", Agdirected, 0);
-  }
-
-  snprintf(label_string, sizeof(label_string), "%s. %d nodes, %d edges.", name,
-           A->m, A->nz);
-
-  if (with_label) agattr(g, AGRAPH, "label", label_string);
-  agattr(g, AGRAPH, "fontcolor", "#808090");
-  if (with_color) agattr(g, AGRAPH, "bgcolor", "black");
-  agattr(g, AGRAPH, "outputorder", "edgesfirst");
-
-  if (A->m > 100) {
-    /* -Estyle=setlinewidth(0.0)' -Eheadclip=false -Etailclip=false -Nstyle=invis*/
-    agattr(g, AGNODE, "style", "invis"); 
-  } else {
-    /*    width=0, height = 0, label="", style=filled*/
-    agattr(g, AGNODE, "shape", "point"); 
-    if (A->m < 50){
-      agattr(g, AGNODE, "width", "0.03"); 
-    } else {
-      agattr(g, AGNODE, "width", "0"); 
-    }
-    agattr(g, AGNODE, "label", ""); 
-    agattr(g, AGNODE, "style", "filled"); 
-    if (with_color) {
-      agattr(g, AGNODE, "color", "#FF0000"); 
-    } else {
-      agattr(g, AGNODE, "color", "#000000"); 
-    }
-  }
-
-  agattr(g, AGEDGE, "headclip", "false"); 
-  agattr(g, AGEDGE, "tailclip", "false"); 
-  if (A->m < 50){
-    agattr(g, AGEDGE, "style", "setlinewidth(2)"); 
-  } else if (A->m < 500){
-    agattr(g, AGEDGE, "style", "setlinewidth(0.5)"); 
-  } else if (A->m < 5000){
-    agattr(g, AGEDGE, "style", "setlinewidth(0.1)"); 
-  } else {
-    agattr(g, AGEDGE, "style", "setlinewidth(0.0)"); 
-  }
-
-  if (with_color) {
-    sym2 = agattr(g, AGEDGE, "color", ""); 
-    sym3 = agattr(g, AGEDGE, "wt", ""); 
-  }
-  for (i = 0; i < A->m; i++) {
-    n = mkNode (g, itos(i).str);
-    ND_id(n) = i;
-    arr[i] = n;
-  }
-
-  if (with_color){
-    real maxdist = 0.;
-    real mindist = 0.;
-    bool first = true;
-    color = malloc(sizeof(real)*A->nz);
-    for (n = agfstnode (g); n; n = agnxtnode (g, n)) {
-      i = ND_id(n);
-      if (A->type != MATRIX_TYPE_REAL || !use_matrix_value){
-       for (j = ia[i]; j < ia[i+1]; j++) {
-         color[j] = distance(x, dim, i, ja[j]);
-         if (i != ja[j]){
-           if (first){
-             mindist = color[j];
-             first = false;
-           } else {
-             mindist = MIN(mindist, color[j]);
-           }
-         }
-         maxdist = MAX(color[j], maxdist);
-       }
-      } else {
-       for (j = ia[i]; j < ia[i+1]; j++) {
-         color[j] = fabs(val[j]);
-         if (i != ja[j]){
-           if (first){
-             mindist = color[j];
-             first = false;
-           } else {
-             mindist = MIN(mindist, color[j]);
-           }
-         }
-         maxdist = MAX(color[j], maxdist);
-       }
-      }
-    }
-    for (n = agfstnode (g); n; n = agnxtnode (g, n)) {
-      i = ND_id(n);
-      for (j = ia[i]; j < ia[i+1]; j++) {
-        if (i != ja[j]){
-         color[j] = ((color[j] - mindist)/MAX(maxdist-mindist, 0.000001));
-        } else {
-          color[j] = 0;
-        }
-      }
-    }
-  }
-
-  for (n = agfstnode (g); n; n = agnxtnode (g, n)) {
-    i = ND_id(n);
-    for (j = ia[i]; j < ia[i+1]; j++) {
-      h = arr [ja[j]];
-      if (val){
-       if (with_color) {
-          if (i != ja[j]){
-            snprintf(buf2, sizeof(buf2), "%s", hue2rgb(.65*color[j], cstring));
-          } else {
-            snprintf(buf2, sizeof(buf2), "#000000");
-          }
-        }
-      } else {
-        if (with_color) {
-          if (i != ja[j]){
-            snprintf(buf2, sizeof(buf2), "%s", hue2rgb(.65*color[j], cstring));
-          } else {
-            snprintf(buf2, sizeof(buf2), "#000000");
-          }
-        }
-     }
-      e = agedge (g, n, h, NULL, 1);
-      if (with_color) {
-       agxset (e, sym2, buf2);
-       snprintf(buf2, sizeof(buf2), "%f", color[j]);
-       agxset (e, sym3, buf2);
-      }
-    }
-  }
-  
-  FREE(color);
-  FREE (arr);
-  return g;
-}
-
 static int hex2int(char h){
   if (h >= '0' && h <= '9') return h - '0';
   if (h >= 'a' && h <= 'f') return 10 + h - 'a';
index 6e391f41d22f55aea1f0710e4b7a08a42cddd8d2..2448b453c0bc165537572bbf0ae0309be3b6f3f5 100644 (file)
@@ -27,7 +27,6 @@ extern void attach_embedding(Agraph_t *g, int dim, double sc, real *x);
 
 extern SparseMatrix SparseMatrix_import_dot(Agraph_t* g, int dim, real **label_sizes, real **x, int *n_edge_label_nodes,
                                            int **edge_label_nodes, int format, SparseMatrix *D);
-extern Agraph_t* makeDotGraph (SparseMatrix, char *title, int dim, real *x, int with_color, int with_label, int use_matrix_value);
 void dump_coordinates(char *name, int n, int dim, real *x);
 char * hue2rgb(real hue, char *color);