Add support for mds model, in which user-supplied edge distances are
authorerg <devnull@localhost>
Wed, 29 Apr 2009 00:48:48 +0000 (00:48 +0000)
committererg <devnull@localhost>
Wed, 29 Apr 2009 00:48:48 +0000 (00:48 +0000)
used rather than weighted shortest paths.

lib/neatogen/constrained_majorization.c
lib/neatogen/constrained_majorization_ipsep.c
lib/neatogen/neato.h

index f11c4c3f73f8ee08d7e65f53d1744adf0c3998c8..57e5318afcee02fc9795ba4028fb6039231abb07 100644 (file)
@@ -159,6 +159,9 @@ stress_majorization_with_hierarchy(
        if (maxi==0)
                return iterations;
 
+    if (Verbose)
+       start_timer();
+
     if (model == MODEL_SUBSET) {
         /* weight graph to separate high-degree nodes */
         /* and perform slower Dijkstra-based computation */
@@ -173,12 +176,21 @@ stress_majorization_with_hierarchy(
             agerr(AGPREV,
                   "is undefined. Reverting to the shortest path model.\n");
         }
+    } else if (model == MODEL_MDS) {
+       if (Verbose)
+           fprintf(stderr, "Calculating MDS model");
+       Dij = mdsModel(graph, n);
     }
     if (!Dij) {
         if (Verbose)
             fprintf(stderr, "Calculating shortest paths");
         Dij = compute_apsp_packed(graph, n);
     }
+    if (Verbose) {
+       fprintf(stderr, ": %.2f sec\n", elapsed_sec());
+       fprintf(stderr, "Setting initial positions");
+       start_timer();
+    }
 
        diameter=-1;
        length = n+n*(n-1)/2;
@@ -253,6 +265,8 @@ stress_majorization_with_hierarchy(
      */
        constant_term=(float)(n*(n-1)/2);
        
+    if (Verbose) fprintf(stderr, ": %.2f sec", elapsed_sec());
+
        /**************************
        ** Laplacian computation **
        **************************/
index b0072077f70086f40c5a7824ac149151a644f4a3..ff15067d9206b8a758b6339a6d4b3903a701fc4e 100644 (file)
@@ -121,6 +121,9 @@ int stress_majorization_cola(
     if (maxi == 0)
        return iterations;
 
+    if (Verbose)
+       start_timer();
+
     if (model == MODEL_SUBSET) {
        /* weight graph to separate high-degree nodes */
        /* and perform slower Dijkstra-based computation */
@@ -135,12 +138,21 @@ int stress_majorization_cola(
            agerr(AGPREV,
                  "is undefined. Reverting to the shortest path model.\n");
        }
+    } else if (model == MODEL_MDS) {
+       if (Verbose)
+           fprintf(stderr, "Calculating MDS model");
+       Dij = mdsModel(graph, n);
     }
     if (!Dij) {
        if (Verbose)
-           fprintf(stderr, "Calculating shortest paths\n ");
+           fprintf(stderr, "Calculating shortest paths");
        Dij = compute_apsp_packed(graph, n);
     }
+    if (Verbose) {
+       fprintf(stderr, ": %.2f sec\n", elapsed_sec());
+       fprintf(stderr, "Setting initial positions");
+       start_timer();
+    }
 
     diameter = -1;
     length = n + n * (n - 1) / 2;
@@ -178,6 +190,7 @@ int stress_majorization_cola(
     for (i = 0; i < n; i++) {
        d_coords[1][i] -= y_0;
     }
+    if (Verbose) fprintf(stderr, ": %.2f sec", elapsed_sec());
 
        /**************************
        ** Laplacian computation **
index 62e4a6a6864f7b97185f890449a76b9239a1cfcb..c5404f3068b77b5c4b25a4b2981be7e4e1835151 100644 (file)
@@ -25,6 +25,7 @@
 #define MODEL_SHORTPATH      0
 #define MODEL_CIRCUIT        1
 #define MODEL_SUBSET         2
+#define MODEL_MDS            3
 
 #define MODE_KK          0
 #define MODE_MAJOR       1