(use srfi-69) (define VERTICES 25000) (define EDGES 1000) (define g (make-hash-table)) (define (insert-edges) (display "\n Hash-tables - Inserting edges\n") (do ((i 0 (+ i 1))) ((= i VERTICES)) (do ((j 0 (+ j 1))) ((= j EDGES)) (hash-table-set! g i `((,j)))))) (insert-edges) $ csc -O3 list-in-hash-table.scm -o list-in-hash-table $ time ./list-in-hash-table Hash-tables - Inserting edges real 0m8.961s user 0m8.897s sys 0m0.028s --------------------------------------------------------------------------- // adjacency list implementation of graph using linked list in c - got from the web #include #include struct adj_node { int index; struct adj_node * next; }; void make_adj(struct adj_node *nod, int adj) { struct adj_node *new_adj = (struct adj_node *)malloc(sizeof(struct adj_node)); new_adj->index = adj; new_adj->next = NULL; while(nod->next != NULL) nod = nod->next; nod->next = new_adj; } int main() { const int VERTEXES = 25000; const int EDGES = 1000; int i, j; struct adj_node graph[VERTEXES]; printf(" C Graph library - Inserting edges"); for(i = 0; i < VERTEXES; i++) { graph[i].index = i; graph[i].next = NULL; for (j = 1; j < EDGES; j++) { make_adj(&graph[i], j); } } return 0; } $ gcc -O3 c-graph.c -o c-graph $ time ./c-graph C Graph library - Inserting edges real 0m27.340s user 0m27.014s sys 0m0.280s