00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "metisbin.h"
00016
00017
00018
00019
00021
00022 int main(int argc, char *argv[])
00023 {
00024 graph_t *graph, *fgraph;
00025 char filename[256];
00026 idx_t wgtflag;
00027 params_t params;
00028
00029 if (argc != 2 && argc != 3) {
00030 printf("Usage: %s <GraphFile> [FixedGraphFile (for storing the fixed graph)]\n", argv[0]);
00031 exit(0);
00032 }
00033
00034 memset((void *)¶ms, 0, sizeof(params_t));
00035 params.filename = gk_strdup(argv[1]);
00036
00037 graph = ReadGraph(¶ms);
00038 if (graph->nvtxs == 0) {
00039 printf("Empty graph!\n");
00040 exit(0);
00041 }
00042
00043 printf("**********************************************************************\n");
00044 printf("%s", METISTITLE);
00045 printf(" (HEAD: %s, Built on: %s, %s)\n", SVNINFO, __DATE__, __TIME__);
00046 printf(" size of idx_t: %zubits, real_t: %zubits, idx_t *: %zubits\n",
00047 8*sizeof(idx_t), 8*sizeof(real_t), 8*sizeof(idx_t *));
00048 printf("\n");
00049 printf("Graph Information ---------------------------------------------------\n");
00050 printf(" Name: %s, #Vertices: %"PRIDX", #Edges: %"PRIDX"\n\n",
00051 params.filename, graph->nvtxs, graph->nedges/2);
00052 printf("Checking Graph... ---------------------------------------------------\n");
00053
00054 if (CheckGraph(graph, 1, 1)) {
00055 printf(" The format of the graph is correct!\n");
00056 }
00057 else {
00058 printf(" The format of the graph is incorrect!\n");
00059 if (argc == 3) {
00060 fgraph = FixGraph(graph);
00061 WriteGraph(fgraph, argv[2]);
00062 FreeGraph(&fgraph);
00063 printf(" A corrected version was stored at %s\n", argv[2]);
00064 }
00065 }
00066
00067 printf("\n**********************************************************************\n");
00068
00069
00070 FreeGraph(&graph);
00071 gk_free((void **)¶ms.filename, ¶ms.tpwgtsfile, ¶ms.tpwgts, LTERM);
00072 }
00073
00074