#include #include #include #define EDGE_PROB 0.2 #define PLUS_INFTY 1000000000 typedef struct { int n; char **type; int **cost; } graph; graph gengraph ( int n ) { graph G; int i, j; printf("%d\n", n); G.n = n; G.type = (char **)malloc(n * sizeof(char *)); G.cost = (int **)malloc(n * sizeof(int *)); for (i=0; i", i); for (j=0; j", i); for (j=0; j 1) ? atoi(argv[1]) : 20; G = gengraph(n); printf("\n+++ Original graph\n"); prngraph(G); H = getAIgraph(G); printf("\n+++ AI subgraph\n"); prngraph(H); C1 = APSP(H); printf("\n+++ Cheapest AI prices\n"); prncosts(C1,n); C2 = APSP1(G,C1); printf("\n+++ Cheapest prices with at most one non-AI leg\n"); prncosts(C2,n); C3 = APSPany(G,C1); printf("\n+++ Cheapest prices with any number of non-AI legs\n"); prncosts(C3,n); exit(0); }