gtsam
3rdparty
metis
programs
graphchk.c
Go to the documentation of this file.
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 9982 2011-05-25 17:18:00Z karypis $
12
*
13
*/
14
15
#include "
metisbin.h
"
16
17
18
19
/*************************************************************************/
21
/*************************************************************************/
22
int
main
(
int
argc,
char
*argv[])
23
{
24
graph_t
*
graph
, *fgraph;
25
char
filename
[256];
26
idx_t
wgtflag;
27
params_t
params
;
28
29
if
(argc != 2 && argc != 3) {
30
printf(
"Usage: %s <GraphFile> [FixedGraphFile (for storing the fixed graph)]\n"
, argv[0]);
31
exit(0);
32
}
33
34
memset((
void
*)&
params
, 0,
sizeof
(
params_t
));
35
params
.filename =
gk_strdup
(argv[1]);
36
37
graph
=
ReadGraph
(&
params
);
38
if
(
graph
->nvtxs == 0) {
39
printf(
"Empty graph!\n"
);
40
exit(0);
41
}
42
43
printf(
"**********************************************************************\n"
);
44
printf(
"%s"
,
METISTITLE
);
45
printf(
" (HEAD: %s, Built on: %s, %s)\n"
, SVNINFO, __DATE__, __TIME__);
46
printf(
" size of idx_t: %zubits, real_t: %zubits, idx_t *: %zubits\n"
,
47
8*
sizeof
(
idx_t
), 8*
sizeof
(
real_t
), 8*
sizeof
(
idx_t
*));
48
printf(
"\n"
);
49
printf(
"Graph Information ---------------------------------------------------\n"
);
50
printf(
" Name: %s, #Vertices: %"
PRIDX
", #Edges: %"
PRIDX
"\n\n"
,
51
params
.filename,
graph
->nvtxs,
graph
->nedges/2);
52
printf(
"Checking Graph... ---------------------------------------------------\n"
);
53
54
if
(
CheckGraph
(
graph
, 1, 1)) {
55
printf(
" The format of the graph is correct!\n"
);
56
}
57
else
{
58
printf(
" The format of the graph is incorrect!\n"
);
59
if
(argc == 3) {
60
fgraph =
FixGraph
(
graph
);
61
WriteGraph
(fgraph, argv[2]);
62
FreeGraph
(&fgraph);
63
printf(
" A corrected version was stored at %s\n"
, argv[2]);
64
}
65
}
66
67
printf(
"\n**********************************************************************\n"
);
68
69
70
FreeGraph
(&
graph
);
71
gk_free
((
void
**)&
params
.filename, &
params
.tpwgtsfile, &
params
.tpwgts,
LTERM
);
72
}
73
74
WriteGraph
void WriteGraph(graph_t *graph, char *filename)
Definition:
programs/io.c:497
gk_strdup
char * gk_strdup(char *orgstr)
Duplicates a string.
Definition:
string.c:372
gk_free
void gk_free(void **ptr1,...)
Definition:
memory.c:202
CheckGraph
#define CheckGraph
Definition:
rename.h:30
params_t
Definition:
fis.c:15
vanilla::params
static const SmartProjectionParams params
Definition:
smartFactorScenarios.h:69
ReadGraph
graph_t * ReadGraph(params_t *params)
Definition:
programs/io.c:22
relicense.filename
filename
Definition:
relicense.py:57
metisbin.h
LTERM
#define LTERM
Definition:
gk_defs.h:14
main
int main(int argc, char *argv[])
Definition:
graphchk.c:22
FreeGraph
#define FreeGraph
Definition:
rename.h:98
FixGraph
#define FixGraph
Definition:
rename.h:32
METISTITLE
#define METISTITLE
Definition:
libmetis/defs.h:18
PRIDX
#define PRIDX
Definition:
include/metis.h:107
real_t
float real_t
Definition:
include/metis.h:132
graph
NonlinearFactorGraph graph
Definition:
doc/Code/OdometryExample.cpp:2
graph_t
Definition:
libmetis/struct.h:82
idx_t
int32_t idx_t
Definition:
include/metis.h:101
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:23