--- /dev/null
+PROG = dot2coord
+
+SRCS = dot2coord.c SparseMatrix.c general.c DotIO.c
+
+OBJS = dot2coord.o SparseMatrix.o general.o DotIO.o
+
+
+LIBS = -lm
+#GVIZ_BUILD_PATH = ..
+GVIZ_BUILD_PATH = /home/yifanhu/GraphViz/graphviz2/build
+#GVIZ_BUILD_PATH = /Users/yifanhu/graphviz2/built
+
+LIBS = -L$(GVIZ_BUILD_PATH)/lib -lgraph -lcdt -lm
+
+
+CC = cc
+#CFLAGS = -g -Wall -DDEBUG -DDEBUG_PRINT
+#CFLAGS = -O3 -Wall -DDEBUG_PRINT
+CFLAGS = -g -DHAVE_DOT -I$(GVIZ_BUILD_PATH)/include/graphviz/ -Wall -DDEBUG_PRINT -DTIME
+CFLAGS = -g -pg -DHAVE_DOT -I$(GVIZ_BUILD_PATH)/include/graphviz/ -Wall -DDEBUG_PRINT -DTIME
+CFLAGS = -O3 -DHAVE_DOT -I$(GVIZ_BUILD_PATH)/include/graphviz/ -Wall -DDEBUG_PRINT -DTIME
+#CFLAGS = -O3 -Wall
+#CFLAGS = -pg -g -Wall -DDEBUG_PRINT
+FC = f77
+FFLAGS = -O
+F90 = f90
+F90FLAGS = -O
+LDFLAGS = -g
+LDFLAGS = $(CFLAGS)
+
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(PROG) $(OBJS) *.mod
+
+.SUFFIXES: $(SUFFIXES) .f90
+
+.f90.o:
+ $(F90) $(F90FLAGS) -c $<
+
+dot2coord.o: SparseMatrix.h
+SparseMatrix.o: SparseMatrix.h general.h
+general.o: general.h
+
+
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include "general.h"
+#include "SparseMatrix.h"
+#include "DotIO.h"
+
+int Verbose;
+
+static FILE* openF (char* fname, char* mode)
+{
+ FILE* f = fopen (fname, mode);
+ if (!f) {
+ fprintf (stderr, "Could not open %s for %s\n", fname,
+ ((*mode == 'r') ? "reading" : "writing"));
+ exit (1);
+ }
+ return f;
+}
+
+real distance(real *x, int dim, int i, int j){
+ int k;
+ real dist = 0.;
+ for (k = 0; k < dim; k++) dist += (x[i*dim+k] - x[j*dim + k])*(x[i*dim+k] - x[j*dim + k]);
+ dist = sqrt(dist);
+ return dist;
+}
+
+
+int main(int argc, char *argv[])
+{
+ Agraph_t* g = 0;
+ char *infile;
+ FILE *f;
+ real *x;
+ real *label_sizes = NULL;
+ int i;
+ SparseMatrix A;
+
+ /* ======================= read graph ==================== */
+ if (argc < 2) {
+ fprintf(stderr, "usage: dot2coord dotfile");
+ exit(1);
+ }
+ infile = argv[1];
+ f = openF (infile, "r");
+
+ aginit ();
+ g = agread (f);
+ A = SparseMatrix_import_dot(g, 2, &label_sizes, &x, FORMAT_CSR);
+
+ for (i = 0; i < A->m; i++) fprintf(stdout, "%lf %lf\n",x[2*i],x[2*i+1]);
+
+ SparseMatrix_delete(A);
+ FREE(x);
+ if (label_sizes) FREE(label_sizes);
+ return 0;
+}