24 #include <sys/types.h>
46 int main(
int argc,
char **argv)
50 #define MY_MAX_COMPONENTS 1024
52 int nret, fd, i, cComponents;
53 char szGraphOutFilename[1024];
62 GNO_OPTION(
"o",
"graphout",
NULL, &pszGraphOut,
"Output Graph file")
71 if (pszGraph ==
NULL || pszGraphOut ==
NULL) {
77 printf(
"Graph read:\n");
78 if ((fd = open(pszGraph, O_RDONLY)) < 0) {
84 fprintf(stderr,
"dglRead error: %s\n",
dglStrerror(&graph));
92 printf(
"Graph depth components spanning:\n");
96 if (cComponents < 0) {
97 fprintf(stderr,
"dglDepthSpanning error: %s\n",
dglStrerror(&graph));
102 printf(
"Connected Component(s) Found: %d\n", cComponents);
104 for (i = 0; i < cComponents; i++) {
105 printf(
"Component %d of %d: ", i + 1, cComponents);
108 printf(
"[flatten...");
116 snprintf(szGraphOutFilename,
sizeof(szGraphOutFilename),
117 "%s-component-%d", pszGraphOut, i);
118 printf(
"[write <%s>...", szGraphOutFilename);
121 open(szGraphOutFilename, O_WRONLY | O_CREAT | O_TRUNC,
128 fprintf(stderr,
"dglWrite error: %s\n",
138 printf(
"component is empty. No output produced.\n");
141 printf(
"[release...");