00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "metisbin.h"
00017
00018
00019
00020
00021
00022
00023 int main(int argc, char *argv[])
00024 {
00025 idx_t i;
00026 idx_t *perm, *iperm;
00027 graph_t *graph;
00028 params_t params;
00029 size_t maxlnz, opc;
00030
00031 if (argc != 3) {
00032 printf("Usage: %s <GraphFile> <PermFile\n", argv[0]);
00033 exit(0);
00034 }
00035
00036 params.filename = gk_strdup(argv[1]);
00037 graph = ReadGraph(¶ms);
00038 if (graph->nvtxs <= 0) {
00039 printf("Empty graph. Nothing to do.\n");
00040 exit(0);
00041 }
00042 if (graph->ncon != 1) {
00043 printf("Ordering can only be applied to graphs with one constraint.\n");
00044 exit(0);
00045 }
00046
00047
00048
00049 perm = imalloc(graph->nvtxs, "main: perm");
00050 iperm = imalloc(graph->nvtxs, "main: iperm");
00051 ReadPOVector(graph, argv[2], iperm);
00052
00053 for (i=0; i<graph->nvtxs; i++)
00054 perm[iperm[i]] = i;
00055
00056 printf("**********************************************************************\n");
00057 printf("%s", METISTITLE);
00058 printf("Graph Information ---------------------------------------------------\n");
00059 printf(" Name: %s, #Vertices: %"PRIDX", #Edges: %"PRIDX"\n\n", argv[1],
00060 graph->nvtxs, graph->nedges/2);
00061 printf("Fillin... -----------------------------------------------------------\n");
00062
00063 ComputeFillIn(graph, perm, iperm, &maxlnz, &opc);
00064
00065 printf(" Nonzeros: %6.3le \tOperation Count: %6.3le\n", (double)maxlnz, (double)opc);
00066
00067
00068 printf("**********************************************************************\n");
00069
00070 FreeGraph(&graph);
00071 }
00072
00073