#include <stdio.h> #include <stdlib.h> #include "graph.h"
int main() { Graph g; int i, j; int ver = 13;
Edge e[] = {{0, 5},{5, 4}, {7, 8}, {4, 3}, {0, 2}, {9, 11}, {0, 1}, {11, 12}, {5, 3}, {9, 12}, {9, 10}, {6, 4}, {0, 6}}; j = sizeof(e) / sizeof(e[0]);
g = graphinit(ver); if (g == NULL) { printf("init graph error\n"); exit(1); }
for (i = 0; i < j; i++) if (graphinserte(g, e[i]) < 0) { printf("insert error\n"); break; }
graphshow(g);
graphdestroy(g); return 0; }
|