]> granicus.if.org Git - graphviz/commitdiff
Add hierarchical constraints. This is enabled only if the compile-time
authorerg <devnull@localhost>
Wed, 13 Jul 2005 20:29:40 +0000 (20:29 +0000)
committererg <devnull@localhost>
Wed, 13 Jul 2005 20:29:40 +0000 (20:29 +0000)
variable DIGCOLA is defined. At present, by default this is undefined.

lib/neatogen/bfs.h
lib/neatogen/defs.h
lib/neatogen/kkutils.c

index 36a8d68a1ddf3f58eb1fa6bcdd4f66be6b40296b..a027d91dd9839d954874b8cbb863da59fb6811a1 100644 (file)
@@ -18,8 +18,6 @@
 extern "C" {
 #endif
 
-
-
 #ifndef _BFS_H_
 #define _BFS_H_
 
index 6ee65a16aca3665e6156208c9c46caac45a16894..8579c5638bfae4d6d1204d6a0a4ecd9461002cab 100644 (file)
@@ -18,8 +18,6 @@
 extern "C" {
 #endif
 
-
-
 #ifndef _DEFS_H_
 #define _DEFS_H_
 
@@ -32,6 +30,7 @@ extern "C" {
        int *edges;
        float *ewgts;
        Style *styles;
+       float *edists; /* directed dist reflecting the direction of the edge */
     };
 
     typedef int DistType;      /* must be signed!! */
@@ -90,6 +89,9 @@ extern "C" {
        node_t *np;             /* original node */
 #ifdef USE_STYLES
        Style *styles;
+#endif
+#ifdef DIGCOLA
+       float *edists; /* directed dist reflecting the direction of the edge */
 #endif
     } vtx_data;
 
index d42dfd791f3a104eb4f34971292f73f6b4fe9d7a..5e34abf201812c10dc812d80b859b21170899e54 100644 (file)
@@ -177,6 +177,30 @@ double distance_kD(double **coords, int dim, int i, int j)
     return sqrt(sum);
 }
 
+static float* fvals;
+static int
+fcmpf (int* ip1, int* ip2)
+{
+    float d1 = fvals[*ip1];
+    float d2 = fvals[*ip2];
+    if (d1 < d2) return -1;
+    else if (d1 > d2) return 1;
+    else return 0;
+}
+
+void quicksort_placef(float *place, int *ordering, int first, int last)
+{
+    if (first < last) {
+       fvals = place;
+       qsort(ordering+first, last-first+1, sizeof(ordering[0]), (qsort_cmpf)fcmpf);
+    }
+}
+
+/* quicksort_place:
+ * For now, we keep the current implementation for stability, but
+ * we should consider replacing this with an implementation similar to
+ * quicksort_placef above.
+ */
 void quicksort_place(double *place, int *ordering, int first, int last)
 {
     if (first < last) {