]> granicus.if.org Git - graphviz/commitdiff
remove lib/spine
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 Oct 2021 04:08:13 +0000 (21:08 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 Oct 2021 21:18:52 +0000 (14:18 -0700)
Despite being compiled and hooked into all three build systems, nothing in
Graphviz uses this and none of its artifacts are installed. Its compilation
appears to be an exercise without purpose.

17 files changed:
configure.ac
graphviz.sln
lib/CMakeLists.txt
lib/Makefile.am
lib/spine/CMakeLists.txt [deleted file]
lib/spine/Makefile.am [deleted file]
lib/spine/quad.c [deleted file]
lib/spine/quad.h [deleted file]
lib/spine/spine.c [deleted file]
lib/spine/spine.h [deleted file]
lib/spine/spine.vcxproj [deleted file]
lib/spine/spine.vcxproj.filters [deleted file]
lib/spine/spinehdr.h [deleted file]
lib/spine/subset.c [deleted file]
lib/spine/subset.h [deleted file]
lib/spine/union_find.c [deleted file]
lib/spine/union_find.h [deleted file]

index f86d3b504b326366fe01b6a7ae34b74796bc266f..7325e92a48d9144b18642fa3d5898c4560b77606 100644 (file)
@@ -2672,7 +2672,6 @@ AC_CONFIG_FILES(Makefile
        lib/ast/Makefile
        lib/sfio/Makefile
        lib/sfio/Sfio_f/Makefile
-       lib/spine/Makefile
        lib/vmalloc/Makefile
        lib/dotgen/Makefile
        lib/neatogen/Makefile
index d4ce94a987ebc72936ccce3de04a16c05a7c9d44..564a5fef2f10f2c10d8fd970966a76a16690ad2e 100644 (file)
@@ -218,12 +218,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccomps", "cmd\tools\ccomps.
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gvplugin_gdiplus", "plugin\gdiplus\gvplugin_gdiplus.vcxproj", "{0F4D5D8F-F4D6-4A5D-97E0-9B482257F493}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spine", "lib\spine\spine.vcxproj", "{4DBC1707-9797-4BAD-8989-08AF459F8840}"
-       ProjectSection(ProjectDependencies) = postProject
-               {C0663A08-F276-4DD6-B17C-E501EE066F7C} = {C0663A08-F276-4DD6-B17C-E501EE066F7C}
-               {83CF0498-7884-49D3-8B3C-263C5AF5FE1B} = {83CF0498-7884-49D3-8B3C-263C5AF5FE1B}
-       EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "version", "lib\version\version.vcxproj", "{320318AF-81FB-446A-9DB4-7D561F712761}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lefty", "cmd\lefty\lefty.vcxproj", "{40597156-1B95-4A22-8F2B-D6B81B747CF0}"
index 0258af038445dd16412d2c1335316f06dae34d2c..7a56fadbc82504868f3cdbdfa37a0cefa491c4c7 100644 (file)
@@ -20,7 +20,6 @@ add_subdirectory(sfio)
 add_subdirectory(rbtree)
 add_subdirectory(sparse)
 add_subdirectory(sfdpgen)
-add_subdirectory(spine)
 add_subdirectory(topfish)
 add_subdirectory(twopigen)
 add_subdirectory(vmalloc)
index 46bfca2159a98fa65ce994f3c6052dbaa76ec4a3..b1145c48425bc71f54498b785f706a7983511469 100644 (file)
@@ -3,6 +3,6 @@
 SUBDIRS = cdt cgraph pathplan sfio vmalloc ast \
        vpsc rbtree ortho sparse patchwork expr common \
        pack xdot label gvc ingraphs topfish glcomp mingle edgepaint \
-       circogen dotgen fdpgen neatogen twopigen sfdpgen osage gvpr spine
+       circogen dotgen fdpgen neatogen twopigen sfdpgen osage gvpr
 
 EXTRA_DIST = gvc.vcxproj*
diff --git a/lib/spine/CMakeLists.txt b/lib/spine/CMakeLists.txt
deleted file mode 100644 (file)
index 75b949f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-add_library(spine STATIC
-    # Header files
-    quad.h
-    spine.h
-    spinehdr.h
-    subset.h
-    union_find.h
-
-    # Source files
-    quad.c
-    spine.c
-    subset.c
-    union_find.c
-)
-
-target_include_directories(spine PRIVATE
-    ${GRAPHVIZ_LIB_DIR}
-    ${GRAPHVIZ_LIB_DIR}/cdt
-    ${GRAPHVIZ_LIB_DIR}/cgraph
-)
diff --git a/lib/spine/Makefile.am b/lib/spine/Makefile.am
deleted file mode 100644 (file)
index c03be86..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/lib \
-       -I$(top_srcdir)/lib/cgraph \
-       -I$(top_srcdir)/lib/cdt
-
-noinst_HEADERS = spinehdr.h quad.h spine.h subset.h union_find.h
-noinst_LTLIBRARIES = libspine_C.la
-
-libspine_C_la_SOURCES = quad.c spine.c subset.c union_find.c
-
-EXTRA_DIST = $(man_MANS)
diff --git a/lib/spine/quad.c b/lib/spine/quad.c
deleted file mode 100644 (file)
index 3db9f2b..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#include <stdlib.h>
-#include <assert.h>
-
-#include <spine/spinehdr.h>
-#include <spine/quad.h>
-#include <spine/subset.h>
-
-static int cmpdeg(const void *v0, const void *v1)
-{
-       Agnode_t *n0 = *(Agnode_t **) v0;
-       Agnode_t *n1 = *(Agnode_t **) v1;
-
-       if (ND_deg(n0) > ND_deg(n1))
-               return -1;
-       else if (ND_deg(n0) < ND_deg(n1))
-               return 1;
-       else
-               return 0;
-}
-
-void genQuads(Agraph_t * g, quadfn_t action, void *state)
-{
-       int nnodes = agnnodes(g);
-       Agnode_t **arr = N_NEW(nnodes, Agnode_t *);
-       Agraph_t *cloneg = agsubg(g, "clone", 1);
-       Dt_t **subs = N_NEW(nnodes, Dt_t *);
-       Agnode_t *n;
-       Agnode_t *v;
-       Agnode_t *u;
-       Agnode_t *w;
-       Agedge_t *e;
-       Agedge_t *f;
-
-       /* make clone graph */
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               agsubnode(cloneg, n, 1);
-               for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-                       agsubedge(cloneg, e, 1);
-               }
-       }
-
-       /* sort the vertices by non-increasing degrees */
-       int j, i = 0;
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               arr[i++] = n;
-               ND_deg(n) = agdegree(cloneg, n, 1, 1);
-       }
-       qsort(arr, nnodes, sizeof(Agnode_t *), cmpdeg);
-
-       /* create index and set for each node */
-       for (i = 0; i < nnodes; i++) {
-               if (i < nnodes - 1)
-                       assert(ND_deg(arr[i]) >= ND_deg(arr[i + 1]));
-               ND_id(arr[i]) = i;
-               subs[i] = mkSubset();
-       }
-
-       for (i = 0; i < nnodes; i++) {
-               v = arr[i];
-               /* for each adjacent node u of v */
-               for (e = agfstedge(cloneg, v); e; e = agnxtedge(cloneg, e, v)) {
-                       if (agtail(e) == aghead(e))
-                               continue;
-                       if (agtail(e) == v)
-                               u = aghead(e);
-                       else
-                               u = agtail(e);
-                       /* for each adjacent node w != v of u */
-                       for (f = agfstedge(cloneg, u); f; f = agnxtedge(cloneg, f, u)) {
-                               if (agtail(f) == aghead(f))
-                                       continue;
-                               if (agtail(f) == u)
-                                       w = aghead(f);
-                               else
-                                       w = agtail(f);
-                               addSubset(subs[ND_id(w)], u);
-                       }
-               }
-               for (j = i + 1; j < nnodes; j++) {
-                       if (sizeSubset(subs[j]) >= 2)
-                               /* generate quadrilaterals */
-                               action(v, arr[j], subs[j], state);
-               }
-               for (j = i + 1; j < nnodes; j++) {
-                       if (sizeSubset(subs[j]) >= 1)
-                               clearSubset(subs[j]);
-               }
-               agdelnode(cloneg, v);
-               closeSubset(subs[i]);
-       }
-
-       agclose(cloneg);
-       free(arr);
-       free(subs);
-}
-
-#ifdef TEST
-static int walker(Agnode_t * n, int *isFirst)
-{
-       if (*isFirst) {
-               *isFirst = 0;
-               printf("%s", agnameof(n));
-       } else
-               printf(",%s", agnameof(n));
-       return 0;
-}
-
-static void
-findQuads(Agnode_t * v, Agnode_t * w, Dt_t * subset, void *state)
-{
-       int first = 1;
-       printf("%s %s {", agnameof(v), agnameof(w));
-       walkSubset(subset, (walkfn) walker, &first);
-       printf("}\n");
-}
-
-int main()
-{
-       Agraph_t *g = agread(stdin, NULL);
-       genQuads(g, findQuads, 0);
-       return 0;
-}
-#endif
diff --git a/lib/spine/quad.h b/lib/spine/quad.h
deleted file mode 100644 (file)
index c40c270..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef QUAD_H
-#define QUAD_H
-
-#include <cgraph.h>
-
-typedef void (*quadfn_t)(Agnode_t*, Agnode_t*, Dt_t*, void*);
-
-extern void genQuads (Agraph_t*, quadfn_t action, void*);
-
-#endif
diff --git a/lib/spine/spine.c b/lib/spine/spine.c
deleted file mode 100644 (file)
index fb42d09..0000000
+++ /dev/null
@@ -1,671 +0,0 @@
-#include <spine/spinehdr.h>
-#include <spine/subset.h>
-#include <spine/quad.h>
-#include <spine/union_find.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#ifdef MAIN
-#include <getopt.h>
-#include <ingraphs/ingraphs.h>
-
-typedef struct {
-       FILE *outfp;
-       char **Files;
-       float sparse_ratio;
-       int verbose;
-} opts_t;
-#endif
-
-typedef int (*qsort_cmpf) (const void *, const void *);
-
-#define MIN(a,b)       ((a)<(b)?(a):(b))
-#define MAX(a,b)       ((a)>(b)?(a):(b))
-
-void* mcalloc (size_t cnt, size_t sz)
-{
-       void* p = calloc(cnt, sz);
-       /* fprintf(stderr, "alloc %lu bytes %p\n", cnt*sz, p); */
-       return p;
-}
-#if 0
-static float ewt(Agedge_t * e)
-{
-       return ED_wt(e);
-}
-#endif
-
-static int cmpe(void *v0, void *v1)
-{
-       Agedge_t *e0 = *(Agedge_t **) v0;
-       Agedge_t *e1 = *(Agedge_t **) v1;
-
-       if (ED_wt(e0) > ED_wt(e1))
-               return -1;
-       else if (ED_wt(e0) < ED_wt(e1))
-               return 1;
-       else
-               return 0;
-}
-
-
-static void doEdge(Agraph_t * g, Agnode_t * v, Agnode_t * w, int *quadcnt)
-{
-       Agedge_t *e = agedge(g, v, w, 0, 0);
-       if (!e)
-               e = agedge(g, w, v, 0, 0);
-       if (!e) {
-               fprintf(stderr, "Could not find edge %s--%s\n", agnameof(v),
-                               agnameof(w));
-               exit(1);
-       }
-       quadcnt[ED_id(e)] += 1;
-}
-
-static void
-recordQuads(Agnode_t * v, Agnode_t * w, Dt_t * subset, void *state)
-{
-       Dtlink_t *link0;
-       Dtlink_t *link1;
-       Agnode_t *u0;
-       Agnode_t *u1;
-       int *quadcnt = (int *) state;
-       Agraph_t *g = agroot(v);
-
-       for (link0 = dtflatten(subset); link0; link0 = dtlink(subset, link0)) {
-               u0 = (Agnode_t *) (((ptritem *) dtobj(subset, link0))->v);
-               for (link1 = dtlink(subset, link0); link1;
-                        link1 = dtlink(subset, link1)) {
-                       u1 = (Agnode_t *) (((ptritem *) dtobj(subset, link1))->v);
-                       doEdge(g, v, u0, quadcnt);
-                       doEdge(g, w, u0, quadcnt);
-                       doEdge(g, v, u1, quadcnt);
-                       doEdge(g, w, u1, quadcnt);
-               }
-       }
-}
-
-static void
-reweightEdge (Agedge_t* e, Dt_t* nbr0, Dt_t* nbr1, Agedge_t*** nbrs, int verbose)
-{
-       Agnode_t* tail = agtail(e);
-       Agnode_t* head = aghead(e);
-       Agedge_t** tail_edgelist = nbrs[ND_id(tail)];
-       long int len0 = nbrs[ND_id(tail)+1] - tail_edgelist;
-       Agedge_t** head_edgelist = nbrs[ND_id(head)];
-       long int len1 = nbrs[ND_id(head)+1] - head_edgelist;
-       long int minlen = MIN(len0, len1);
-       long int i;
-       long int maxi = 0;
-       double wt, maxwt = 0;
-       double common_cnt = 0;
-       double union_cnt = 0;
-       Agnode_t* n0;
-       Agnode_t* n1;
-       double oldwt;
-
-       clearSubset(nbr0);
-       clearSubset(nbr1);
-               
-       if (verbose > 1)
-               oldwt = ED_wt(e);
-
-#ifdef TEST_JACCARD
-    Dt_t* nbr00 = mkSubset();
-       Dt_t* nbr11 = mkSubset();
-    double wt0;
-#endif
-       for (i = 0; i < minlen; i++) {
-               n0 = (*tail_edgelist++)->node;
-               n1 = (*head_edgelist++)->node;
-               assert(n0 != tail);
-               assert(n1 != head);
-#ifdef TEST_JACCARD
-               addSubset(nbr00, n0);
-               addSubset(nbr11, n1);
-#endif
-/* fprintf (stderr, "add %s  %s\n", agnameof(n0), agnameof(n1)); */
-               if (n0 != n1) {
-                       if (inSubset(nbr1, n0)) common_cnt++;
-                       else {
-                               addSubset (nbr0, n0);
-                               union_cnt++;
-                       }
-                       if (inSubset(nbr0, n1)) common_cnt++;
-            else {
-                               addSubset (nbr1, n1);
-                               union_cnt++;
-                       }
-               }
-               else {
-                       common_cnt++;
-                       union_cnt++;
-               }
-               wt = common_cnt/union_cnt;
-#ifdef TEST_JACCARD
-               wt0 = ((double)intersect_size(nbr00,nbr11))/union_size(nbr00,nbr11);
-               assert(wt == wt0);
-#endif
-               if (wt > maxwt) {
-                       maxi = i;
-                       maxwt = wt;
-               }
-       }
-       if (len0 > minlen) {
-               for (; i < len0; i++) {
-                       n0 = (*tail_edgelist++)->node;
-/* fprintf (stderr, "add %s  -\n", agnameof(n0)); */
-#ifdef TEST_JACCARD
-                       addSubset(nbr00, n0);
-#endif
-                       if (inSubset(nbr1, n0)) common_cnt++;
-                       else union_cnt++;
-                       wt = common_cnt/union_cnt;
-#ifdef TEST_JACCARD
-                       wt0 = ((double)intersect_size(nbr00,nbr11))/union_size(nbr00,nbr11);
-                       assert(wt == wt0);
-#endif
-                       if (wt > maxwt) {
-                               maxi = i;
-                               maxwt = wt;
-                       }
-               }
-       }
-       else if (len1 > minlen) {
-               for (; i < len1; i++) {
-                       n1 = (*head_edgelist++)->node;
-/* fprintf (stderr, "add - %s\n", agnameof(n1)); */
-#ifdef TEST_JACCARD
-                       addSubset(nbr11, n1);
-#endif
-                       if (inSubset(nbr0, n1)) common_cnt++;
-                       else union_cnt++;
-                       wt = common_cnt/union_cnt;
-#ifdef TEST_JACCARD
-                       wt0 = ((double)intersect_size(nbr00,nbr11))/union_size(nbr00,nbr11);
-                       assert(wt == wt0);
-#endif
-                       if (wt > maxwt) {
-                               maxi = i;
-                               maxwt = wt;
-                       }
-               }
-       }
-       
-       ED_wt(e) = maxwt;
-       if (verbose > 1)
-               fprintf(stderr, "%s : %s %f %ld/%ld %f\n",
-                       agnameof(tail), agnameof(head), maxwt, maxi, MAX(len0, len1), oldwt);
-#ifdef TEST_JACCARD
-    closeSubset(nbr00);
-    closeSubset(nbr11);
-#endif
-}
-
-static void setEdgeWeights(Agraph_t * g, int verbose)
-{
-       int *quadcnt = N_NEW((size_t)agnedges(g), int);
-       int ncnt = agnnodes(g);
-       int *que = N_NEW((size_t)ncnt, int);
-       Agnode_t *n;
-       Agedge_t *e;
-       int iwt;
-       int edgecnt = 0; 
-       long int i = 0;
-
-    /* Count the number q(u,v) of quadrilaterals each edge is in.
-     * This is stored in quadcnt, indexed by the edges index. 
-     */
-       genQuads(g, recordQuads, quadcnt);
-
-    /* Weight node v by q(v), the sum of the q(u,v) for all neighbors v of u.
-     * This is stored in que, indexed by the node's index.
-     */
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               ND_id(n) = i++;
-               iwt = 0;
-               for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-                       iwt += quadcnt[ED_id(e)];
-                       edgecnt++;
-               }
-               for (e = agfstin(g, n); e; e = agnxtin(g, e)) {
-                       iwt += quadcnt[ED_id(e)];
-               }
-               que[ND_id(n)] = iwt;
-#if 0
-               fprintf(stderr, " %s quad %d\n", agnameof(n), que[ND_id(n)]);
-#endif
-       }
-
-    /* Assign each edge a normalized initial weight Q(u,v) which is q(u,v)/sqrt(q(u)q(v)).
-     * This is stored in ED_wt.
-     */
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-                       int quadv = quadcnt[ED_id(e)];
-                       if (quadv)
-                               ED_wt(e) =
-                                       quadv /
-                                       sqrt((double) (que[ND_id(n)] * que[ND_id(aghead(e))]));
-                       else
-                               ED_wt(e) = 0;
-#if 0
-                       fprintf(stderr, " %s--%s quadcnt %d wt %f\n",
-                                       agnameof(n), agnameof(aghead(e)), quadcnt[ED_id(e)],
-                                       jD_wt(e));
-#endif
-               }
-       }
-
-       free(quadcnt);
-       free(que);
-
-       Agedge_t** edges = N_NEW((size_t)(2*edgecnt+1),Agedge_t*);
-       Agedge_t*** nbrs = N_NEW((size_t)ncnt+1, Agedge_t**);
-       Agedge_t** edgelist = edges;
-       size_t degree;
-    /* For each node, sort its edges by Q(u,v). */
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               degree = 0;
-               nbrs[ND_id(n)] = edgelist;
-               for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-                       degree++;
-                       *edgelist++ = e;
-               }
-               for (e = agfstin(g, n); e; e = agnxtin(g, e)) {
-                       degree++;
-                       *edgelist++ = e;
-               }
-               qsort(nbrs[ND_id(n)], degree, sizeof(Agedge_t **), (qsort_cmpf)cmpe);
-/*
-               fprintf (stderr, "sort %s(%d) degree %lu %d %p\n", 
-                       agnameof(n), ND_id(n), degree, agdegree(g,n,1,1), nbrs[ND_id(n)]);
-*/
-       }
-       nbrs[ncnt] = edgelist;
-
-#if 0
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               edgelist = nbrs[ND_id(n)];
-               long int len0 = nbrs[ND_id(n)+1] - edgelist;
-               fprintf (stderr, "%s len %lu degree %d\n", agnameof(n), len0, agdegree(g,n,1,1));
-               for (i = 0; i < len0; i++) {
-                       e = *edgelist++;
-                       fprintf (stderr, "%s %s %lf\n",
-                               agnameof(agtail(e)), agnameof(aghead(e)), ED_wt(e));
-               }
-       }
-#endif
-
-    /* Finally, for each edge (u,v), compute the Jaccard coefficient of the union of
-     * k neighbors of u and v, using the sorted edges. The final edge weight is the
-     * maximum Jaccard coefficient.
-     */
-       Dt_t* nbr0 = mkSubset();
-       Dt_t* nbr1 = mkSubset();
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               edgelist = nbrs[ND_id(n)];
-               long int len0 = nbrs[ND_id(n)+1] - edgelist;
-               for (i = 0; i < len0; i++) {
-                       e = *edgelist++;
-                       if (AGTYPE(e)==AGINEDGE) continue;
-                       reweightEdge (e, nbr0, nbr1, nbrs, verbose);
-               }
-       }
-       closeSubset(nbr0);
-       closeSubset(nbr1);
-       free(edges);
-       free(nbrs);
-}
-
-/* Return number in range [0,nedges] */
-static size_t computeIndex(size_t nedges, float s)
-{
-       size_t r = ceilf(nedges * (1 - s));
-       return r;
-}
-
-static size_t doBucket(Agedge_t ** edgelist, size_t idx, Dt_t * M)
-{
-       Agedge_t *e;
-       float weight = ED_wt(edgelist[idx]);
-
-       while ((e = edgelist[idx]) && (ED_wt(e) == weight)) {
-               idx++;
-               if (UF_find(agtail(e)) != UF_find(aghead(e)))
-                       addSubset(M, e);
-       }
-
-       return idx;
-}
-
-static int walker(Agedge_t * e, Agraph_t * sg)
-{
-       UF_union(agtail(e), aghead(e));
-       agsubedge(sg, e, 1);
-       return 0;
-}
-
-static Agraph_t *findUMST(Agraph_t * g, Agedge_t ** edgelist, size_t nedges)
-{
-       Agraph_t *sg = agsubg(g, "UMST", 1);
-       Dt_t *M = mkSubset();
-
-       size_t i = 0;
-       while (i < nedges) {
-               i = doBucket(edgelist, i, M);
-               /* for each edge in M, add to sg, and union nodes */
-               walkSubset(M, (walkfn) walker, sg);
-               if (i < nedges)
-                       clearSubset(M);
-       }
-       closeSubset(M);
-       return sg;
-}
-
-/* Remove loops and multiedges. */
-static void cleanGraph (Agraph_t * g, int verbose)
-{
-       Agnode_t *n;
-       Agnode_t *head;
-       Agedge_t *e;
-       Agedge_t *nexte;
-       Agedge_t *inexte;
-       Agedge_t *backe;
-       Agedge_t *preve = NULL;
-    int loopcnt = 0;
-    int multicnt = 0;
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               preve = NULL;
-               for (e = agfstout(g, n); e; e = nexte) {
-                       head = aghead(e);
-                       nexte = agnxtout(g, e);
-                       if (head == n) {
-                               agdelete(g, e);
-                               preve = NULL;
-                               loopcnt++;
-                       }
-                       else if (preve && (head == aghead(preve))) {
-                               agdelete(g, e);
-                               multicnt++;
-                       }
-                       else {
-                               preve = e;
-                               if ((backe = agedge(g, head, n, 0, 0))) {
-                                       while (backe && (agtail(backe) == head)) {
-                                               multicnt++;
-                                               inexte = agnxtin(g, backe);     
-                                               agdelete(g, backe);
-                                               backe = inexte;
-                                       }
-                               }
-                       
-                       }
-               }
-       }
-       if (verbose)
-               fprintf (stderr, "cleanGraph: %d loops %d multiedges removed\n", loopcnt, multicnt);
-}
-
-void genSpine(Agraph_t * g, float sparse_ratio, int verbose)
-{
-       Agraph_t *sg_union;
-       Agnode_t *n;
-       Agedge_t *e;
-       Agedge_t **edgelist;
-       size_t i, index;
-       size_t nedges;
-       float threshold;
-
-       cleanGraph (g, verbose);
-       nedges = agnedges(g);
-       if (verbose)
-               fprintf(stderr, "Graph %s %d nodes %lu edges:\n", agnameof(g),
-                               agnnodes(g), nedges);
-       aginit(g, AGNODE, "nodeinfo", sizeof(nodeinfo_t), 1);
-       aginit(g, AGEDGE, "edgeinfo", sizeof(edgeinfo_t), 1);
-
-       int eidx = 0;
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-                       ED_id(e) = eidx++;
-               }
-       }
-       if (verbose)
-               fprintf(stderr, "setEdgeWeights\n");
-       setEdgeWeights(g, verbose);
-
-       /* sort edges by non-increasing weight */
-       if (verbose)
-               fprintf(stderr, "sorting\n");
-       edgelist = N_NEW((size_t)(nedges + 1), Agedge_t *);     /* NULL at end */
-       i = 0;
-       for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-               for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
-                       edgelist[i++] = e;
-               }
-       }
-       qsort(edgelist, nedges, sizeof(Agedge_t *), (qsort_cmpf)cmpe);
-#if 0
-       float curwt = -1;
-       int cnt = 0;
-       for (i = 0; i <= nedges; i++) {
-               e = edgelist[i];
-               if (e && (ED_wt(e) == curwt))
-                       cnt++;
-               else {
-                       if (cnt)
-                               fprintf(stderr, "%f %d\n", curwt, cnt);
-                       if (e) {
-                               cnt = 1;
-                               curwt = ED_wt(e);
-                       }
-               }
-       }
-#endif
-       if (verbose)
-               fprintf(stderr, "heaviest wt %f least wt %f\n", ED_wt(edgelist[0]),
-                               ED_wt(edgelist[nedges - 1]));
-
-       /* compute UMST */
-       sg_union = findUMST(g, edgelist, nedges);
-       int umst_size = agnedges(sg_union);
-       if (verbose)
-               fprintf(stderr, " union of maximum spanning trees: %d edges\n",
-                               umst_size);
-
-       /* Find index of the |E|(1-sparse_ratio)th edge */
-       index = computeIndex(nedges, sparse_ratio);
-       if (verbose)
-               fprintf(stderr, " index %lu out of %lu\n", index, nedges);
-
-       /* set of edges with weights above threshold */
-       /* Add all edges with wt >= wt(edgelist[index]) */
-       /* As edgelist is sorted, first index edges */
-       int extra_edges = 0;
-       for (i = 1; i <= index; i++) {
-               e = edgelist[i - 1];
-               if (verbose) {
-                       if (agsubedge(sg_union, e, 0) == NULL)
-                               extra_edges++;
-               }
-               agsubedge(sg_union, e, 1);
-       }
-
-       /* Add any additional edges with same weight as e */
-       if (index) {
-               threshold = ED_wt(e);
-               for (; i <= nedges; i++) {
-                       e = edgelist[i - 1];
-                       if (ED_wt(e) >= threshold) {
-                               if (verbose) {
-                                       if (agsubedge(sg_union, e, 0) == NULL)
-                                               extra_edges++;
-                               }
-                               agsubedge(sg_union, e, 1);
-                       } else
-                               break;
-               }
-       }
-       if (verbose)
-               fprintf(stderr,
-                               "number of extra edges not in UMST %d total edges %d\n",
-                               extra_edges, agnedges(sg_union));
-
-       /* layout graph sg_union */
-       Agsym_t *sym = agattr(g, AGEDGE, "spine", "0");
-       int ncnt = 0;
-       int ecnt = 0;
-       for (n = agfstnode(sg_union); n; n = agnxtnode(sg_union, n)) {
-               ncnt++;
-               for (e = agfstout(sg_union, n); e; e = agnxtout(sg_union, e)) {
-                       ecnt++;
-                       agxset(e, sym, "1");
-               }
-       }
-       if (verbose)
-               fprintf(stderr, "final ncnt %d ecnt %d\n", ncnt, ecnt);
-}
-
-#ifdef MAIN
-
-static FILE *openFile(const char *cmd, const char *name)
-{
-       FILE *fp;
-
-       fp = fopen(name, "w");
-       if (!fp) {
-               fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
-               exit(1);
-       }
-       return fp;
-}
-
-static int setInt(char *s, int *v)
-{
-       char *endp;
-       long int l = strtol(s, char &endp, 10);
-
-       if (s == endp) {
-               fprintf(stderr, "Option value \"%s\" must be an integer\n", s);
-               return 1;
-       }
-       if (l < 0) {
-               fprintf(stderr, "Option value \"%s\" must be non-negative.\n", s);
-               return 1;
-       }
-       *v = (int)l;
-       return 0;
-
-}
-
-static int setFloat(char *s, float *v)
-{
-       char *endp;
-       float f = strtof(s, &endp);
-       if (s == endp) {
-               fprintf(stderr, "Option value \"%s\" must be a float\n", s);
-               return 1;
-       }
-       if ((f < 0) || (f > 1)) {
-               fprintf(stderr, "Option value \"%s\" must be in the range [0,1]\n",
-                               s);
-               return 1;
-       }
-       *v = f;
-       return 0;
-
-}
-
-static char *Usage = "Usage: %s [-?] [options]\n\
- -r<n>         : sparsification ratio [0,1] (0.5) \n\
- -o<outfile>   : put output in <outfile> (stderr)\n\
- -v[<val>]     : verbose mode \n\
- -?            : print usage\n";
-
-static void usage(char *cmd, int v)
-{
-       fprintf(v ? stderr : stdout, Usage, cmd);
-       exit(v);
-}
-
-static void doOpts(int argc, char *argv[], opts_t * op)
-{
-       int c;
-       char *cmd = argv[0];
-
-       op->outfp = NULL;
-       op->Files = NULL;
-       op->verbose = 0;
-       op->sparse_ratio = 0.5;
-
-       opterr = 0;
-       while ((c = getopt(argc, argv, "o:r:v::?")) != -1) {
-               switch (c) {
-               case 'o':
-                       op->outfp = openFile(cmd, optarg);
-                       break;
-               case 'v':
-                       if (optarg)
-                               if (setInt(optarg, &(op->verbose))) {
-                                       fprintf(stderr, "%s: bad value for flag -%c - ignored\n",
-                                                       cmd, c);
-                               }
-                       }
-                       else
-                               op->verbose = 1;
-                       break;
-               case 'r':
-                       if (setFloat(optarg, &(op->sparse_ratio))) {
-                               fprintf(stderr, "%s: bad value for flag -%c - ignored\n",
-                                               cmd, c);
-                       }
-                       break;
-               case '?':
-                       if (optopt == '\0')
-                               usage(cmd, 0);
-                       else {
-                               fprintf(stderr, "%s: option -%c unrecognized\n",
-                                               cmd, optopt);
-                               usage(cmd, 1);
-                       }
-                       break;
-               default:
-                       break;
-               }
-       }
-       argv += optind;
-       argc -= optind;
-
-       if (argc)
-               op->Files = argv;
-       if (op->outfp == NULL)
-               op->outfp = stderr;
-       if (op->verbose)
-               fprintf(stderr, "sparse ratio = %f\n", op->sparse_ratio);
-}
-
-static Agraph_t *gread(FILE * fp)
-{
-       return agread(fp, NULL);
-}
-
-int main(int argc, char *argv[])
-{
-       opts_t opts;
-       ingraph_state ig;
-       Agraph_t *g;
-
-       doOpts(argc, argv, &opts);
-       newIngraph(&ig, opts.Files, gread);
-       while ((g = nextGraph(&ig)) != 0) {
-               genSpine(g, opts.sparse_ratio, opts.verbose);
-               agwrite(g, opts.outfp);
-               agclose(g);
-       }
-
-       return 0;
-}
-#endif
diff --git a/lib/spine/spine.h b/lib/spine/spine.h
deleted file mode 100644 (file)
index d98fa0b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef SPINE_T
-#define SPINE_T
-
-#include <cgraph.h>
-
-void genSpine (Agraph_t * g, float sparse_ratio, int verbose);
-
-#endif
diff --git a/lib/spine/spine.vcxproj b/lib/spine/spine.vcxproj
deleted file mode 100644 (file)
index beabf5b..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="quad.c" />
-    <ClCompile Include="spine.c" />
-    <ClCompile Include="subset.c" />
-    <ClCompile Include="union_find.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="quad.h" />
-    <ClInclude Include="spine.h" />
-    <ClInclude Include="spinehdr.h" />
-    <ClInclude Include="subset.h" />
-    <ClInclude Include="union_find.h" />
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{4DBC1707-9797-4BAD-8989-08AF459F8840}</ProjectGuid>
-    <RootNamespace>spine</RootNamespace>
-    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v142</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v142</PlatformToolset>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>Application</ConfigurationType>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v142</PlatformToolset>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-    <CharacterSet>MultiByte</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Label="Shared">
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)$(Configuration)\Graphviz\bin\</OutDir>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)$(Configuration)\Graphviz\bin\</OutDir>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)lib;$(SolutionDir)lib\cdt;$(SolutionDir)lib\cgraph;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4996</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>cdt.lib;cgraph.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>Disabled</Optimization>
-      <SDLCheck>true</SDLCheck>
-    </ClCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WarningLevel>Level4</WarningLevel>
-      <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)lib;$(SolutionDir)lib\cdt;$(SolutionDir)lib\cgraph;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4996</DisableSpecificWarnings>
-    </ClCompile>
-    <Link>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>cdt.lib;cgraph.lib;%(AdditionalDependencies)</AdditionalDependencies>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <WarningLevel>Level3</WarningLevel>
-      <Optimization>MaxSpeed</Optimization>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <SDLCheck>true</SDLCheck>
-    </ClCompile>
-    <Link>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <OptimizeReferences>true</OptimizeReferences>
-    </Link>
-  </ItemDefinitionGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
\ No newline at end of file
diff --git a/lib/spine/spine.vcxproj.filters b/lib/spine/spine.vcxproj.filters
deleted file mode 100644 (file)
index 20aed52..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <Filter Include="Source Files">
-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
-    </Filter>
-    <Filter Include="Header Files">
-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
-      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
-    </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="quad.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="spine.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="subset.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="union_find.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="quad.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="spine.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="spinehdr.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="subset.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="union_find.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/lib/spine/spinehdr.h b/lib/spine/spinehdr.h
deleted file mode 100644 (file)
index e9e5d12..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef SPINEHDR_T
-#define SPINEHDR_T
-
-#include <spine/spine.h>
-
-#define N_NEW(n,t)       (t*)mcalloc((n),sizeof(t))
-#define NEW(t)       (t*)mcalloc((1),sizeof(t))
-
-extern void *mcalloc(size_t nmemb, size_t size);
-
-#define NOTUSED(var)     (void) var
-
-typedef struct {
-       Agrec_t h;
-       int id;
-       int deg;
-       int UF_size;
-       Agnode_t *UF_parent;
-} nodeinfo_t;
-
-typedef struct {
-       Agrec_t h;
-       float weight;
-       int id;
-} edgeinfo_t;
-
-#define ED_wt(e) (((edgeinfo_t*)AGDATA(e))->weight)
-#define ED_id(e) (((edgeinfo_t*)AGDATA(e))->id)
-#define ND_id(n) (((nodeinfo_t*)AGDATA(n))->id)
-#define ND_deg(n) (((nodeinfo_t*)AGDATA(n))->deg)
-#define ND_UF_parent(n) (((nodeinfo_t*)AGDATA(n))->UF_parent)
-#define ND_UF_size(n) (((nodeinfo_t*)AGDATA(n))->UF_size)
-
-#endif
diff --git a/lib/spine/subset.c b/lib/spine/subset.c
deleted file mode 100644 (file)
index 282ab58..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#include <spine/spinehdr.h>
-#include <stdlib.h>
-#include <spine/subset.h>
-
-static void *mkPtrItem(Dt_t * d, ptritem * obj, Dtdisc_t * disc)
-{
-       NOTUSED(d);
-       NOTUSED(disc);
-       ptritem *np = NEW(ptritem);
-       np->v = obj->v;
-       return (void *) np;
-}
-
-static void freePtrItem(Dt_t * d, ptritem * obj, Dtdisc_t * disc)
-{
-       NOTUSED(d);
-       NOTUSED(disc);
-       free(obj);
-}
-
-static int cmpptr(Dt_t * d, void **key1, void **key2, Dtdisc_t * disc)
-{
-       NOTUSED(d);
-       NOTUSED(disc);
-       if (*key1 > *key2)
-               return 1;
-       else if (*key1 < *key2)
-               return -1;
-       else
-               return 0;
-}
-
-static Dtdisc_t ptrdisc = {
-       offsetof(ptritem, v),
-       sizeof(void *),
-       offsetof(ptritem, link),
-       (Dtmake_f) mkPtrItem,
-       (Dtfree_f) freePtrItem,
-       (Dtcompar_f) cmpptr,
-       0,
-       0,
-       0
-};
-
-Dt_t *mkSubset()
-{
-       Dt_t *s = dtopen(&ptrdisc, Dtoset);
-       return s;
-}
-
-void addSubset(Dt_t * s, void *n)
-{
-       ptritem dummy;
-
-       dummy.v = n;
-       dtinsert(s, &dummy);
-}
-
-void* inSubset(Dt_t * s, void *n)
-{
-       return dtmatch(s, &n);
-}
-
-int sizeSubset(Dt_t * s)
-{
-       return dtsize(s);
-}
-
-void clearSubset(Dt_t * s)
-{
-       dtclear(s);
-}
-
-void closeSubset(Dt_t * s)
-{
-       dtclose(s);
-}
-
-typedef struct {
-       Dt_t* s;
-    int sz;
-} setsize_t;
-
-static int union_fn(Agnode_t * n, setsize_t *state)
-{
-       if (!inSubset(state->s, n))
-               state->sz++;
-       return 0;
-}
-
-int union_size(Dt_t* s0, Dt_t* s1)
-{
-       setsize_t state;
-
-    state.s = s0;
-       state.sz = sizeSubset(s0);
-       walkSubset(s1, (walkfn)union_fn, &state);
-       return state.sz;
-}
-
-static int intersect_fn(Agnode_t * n, setsize_t *state)
-{
-       if (inSubset(state->s, n))
-               state->sz++;
-       return 0;
-}
-
-int intersect_size(Dt_t* s0, Dt_t* s1)
-{
-       setsize_t state;
-
-    state.s = s0;
-       state.sz = 0;
-       walkSubset(s1, (walkfn)intersect_fn, &state);
-       return state.sz;
-}
-
-typedef struct {
-       walkfn wf;
-       void *state;
-} auxstate;
-
-static int auxfn(Dt_t * s, void *data, void *state)
-{
-       NOTUSED(s);
-       return ((auxstate *) state)->wf(((ptritem *) data)->v,
-                                                                       ((auxstate *) state)->state);
-}
-
-void walkSubset(Dt_t * s, walkfn wf, void *state)
-{
-       auxstate xstate;
-
-       xstate.wf = wf;
-       xstate.state = state;
-       dtwalk(s, auxfn, &xstate);
-}
diff --git a/lib/spine/subset.h b/lib/spine/subset.h
deleted file mode 100644 (file)
index 1d66f38..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef SUBSET_H
-#define SUBSET_H
-
-#include <cdt.h>
-
-typedef struct {
-    Dtlink_t  link;
-    void* v;
-} ptritem;
-
-typedef int (*walkfn)(void*, void*);
-
-extern Dt_t* mkSubset(void);
-extern void addSubset(Dt_t*, void*);
-extern void* inSubset(Dt_t*, void *);
-extern void walkSubset(Dt_t*, walkfn, void*);
-extern int sizeSubset(Dt_t*);
-extern void clearSubset(Dt_t*);
-extern void closeSubset(Dt_t*);
-extern int intersect_size(Dt_t*, Dt_t*);
-extern int union_size(Dt_t*, Dt_t*);
-
-#endif
diff --git a/lib/spine/union_find.c b/lib/spine/union_find.c
deleted file mode 100644 (file)
index 7253339..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <spine/spinehdr.h>
-#include <spine/union_find.h>
-#include <assert.h>
-
-typedef Agnode_t node_t;
-
-/* union-find */
-node_t *UF_find(node_t * n)
-{
-       while (ND_UF_parent(n) && (ND_UF_parent(n) != n)) {
-               if (ND_UF_parent(ND_UF_parent(n)))
-                       ND_UF_parent(n) = ND_UF_parent(ND_UF_parent(n));
-               n = ND_UF_parent(n);
-       }
-       return n;
-}
-
-node_t *UF_union(node_t * u, node_t * v)
-{
-       if (u == v)
-               return u;
-       if (ND_UF_parent(u) == NULL) {
-               ND_UF_parent(u) = u;
-               ND_UF_size(u) = 1;
-       } else
-               u = UF_find(u);
-       if (ND_UF_parent(v) == NULL) {
-               ND_UF_parent(v) = v;
-               ND_UF_size(v) = 1;
-       } else
-               v = UF_find(v);
-       if (u == v)
-               return u;
-       if (ND_UF_size(u) < ND_UF_size(v)) {
-               ND_UF_parent(u) = v;
-               ND_UF_size(v) += ND_UF_size(u);
-       } else {
-               ND_UF_parent(v) = u;
-               ND_UF_size(u) += ND_UF_size(v);
-               v = u;
-       }
-       return v;
-}
-
-void UF_remove(node_t * u, node_t * v)
-{
-       assert(ND_UF_size(u) == 1);
-       ND_UF_parent(u) = u;
-       ND_UF_size(v) -= ND_UF_size(u);
-}
-
-void UF_singleton(node_t * u)
-{
-       ND_UF_size(u) = 1;
-       ND_UF_parent(u) = NULL;
-}
-
-void UF_setname(node_t * u, node_t * v)
-{
-       assert(u == UF_find(u));
-       ND_UF_parent(u) = v;
-       ND_UF_size(v) += ND_UF_size(u);
-}
diff --git a/lib/spine/union_find.h b/lib/spine/union_find.h
deleted file mode 100644 (file)
index 102f5b4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef UNION_FIND_H
-#define UNION_FIND_H
-
-#include <cgraph.h>
-
-    extern Agnode_t *UF_find(Agnode_t *);
-    extern Agnode_t *UF_union(Agnode_t *, Agnode_t *);
-    extern void UF_remove(Agnode_t *, Agnode_t *);
-    extern void UF_singleton(Agnode_t *);
-    extern void UF_setname(Agnode_t *, Agnode_t *);
-
-#endif