Created
September 14, 2012 11:18
-
-
Save foota/3721375 to your computer and use it in GitHub Desktop.
Generate lattice graphs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generate lattice graphs. */ | |
#include "gb_graph.h" | |
#include "gb_basic.h" | |
#include "gb_save.h" | |
int main(int argc, char* argv[]) | |
{ | |
if (argc < 4) { | |
fprintf(stderr, "Usage %s N M outfile\n", argv[0]); | |
exit(1); | |
} | |
int N = atoi(argv[1]); | |
int M = atoi(argv[2]); | |
Graph* g; | |
g = board(N, M, 0L, 0L, 1L, 0L, 0L); | |
save_graph(g, argv[3]); | |
if (g) { | |
register Vertex* v; | |
printf("Graph->ID: %s\n", g->id); | |
printf("N of vertices: %ld, N of arcs: %ld\n\n", g->n, g->m); | |
for (v = g->vertices; v < g->vertices + g->n; v++) { | |
printf("%s\n", v->name); | |
register Arc* a; | |
for(a = v->arcs; a; a= a->next) | |
printf(" -> %s, length %ld\n", a->tip->name, a->len); | |
} | |
} else printf("Something went wrong (panic code %ld)!\n", panic_code); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment