1 | /* |
---|
2 | * Copyright 1997, Regents of the University of Minnesota |
---|
3 | * |
---|
4 | * graphchk.c |
---|
5 | * |
---|
6 | * This file checks the validity of a graph |
---|
7 | * |
---|
8 | * Started 8/28/94 |
---|
9 | * George |
---|
10 | * |
---|
11 | * $Id: graphchk.c,v 1.1 1998/11/27 17:59:33 karypis Exp $ |
---|
12 | * |
---|
13 | */ |
---|
14 | |
---|
15 | #include <metis.h> |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | /************************************************************************* |
---|
20 | * Let the game begin |
---|
21 | **************************************************************************/ |
---|
22 | main(int argc, char *argv[]) |
---|
23 | { |
---|
24 | GraphType graph; |
---|
25 | char filename[256]; |
---|
26 | int wgtflag; |
---|
27 | |
---|
28 | if (argc != 2) { |
---|
29 | printf("Usage: %s <GraphFile>\n", argv[0]); |
---|
30 | exit(0); |
---|
31 | } |
---|
32 | |
---|
33 | strcpy(filename, argv[1]); |
---|
34 | |
---|
35 | ReadGraph(&graph, filename, &wgtflag); |
---|
36 | if (graph.nvtxs == 0) { |
---|
37 | printf("Empty graph!\n"); |
---|
38 | exit(0); |
---|
39 | } |
---|
40 | |
---|
41 | printf("**********************************************************************\n"); |
---|
42 | printf("%s", METISTITLE); |
---|
43 | printf("Graph Information ---------------------------------------------------\n"); |
---|
44 | printf(" Name: %s, #Vertices: %d, #Edges: %d\n\n", filename, graph.nvtxs, graph.nedges/2); |
---|
45 | printf("Checking Graph... ---------------------------------------------------\n"); |
---|
46 | |
---|
47 | if (CheckGraph(&graph)) |
---|
48 | printf(" The format of the graph is correct!\n"); |
---|
49 | else |
---|
50 | printf(" The format of the graph is incorrect!\n"); |
---|
51 | |
---|
52 | printf("\n**********************************************************************\n"); |
---|
53 | |
---|
54 | |
---|
55 | GKfree(&graph.xadj, &graph.adjncy, &graph.vwgt, &graph.adjwgt, LTERM); |
---|
56 | } |
---|
57 | |
---|
58 | |
---|