diff options
author | Julian T <julian@jtle.dk> | 2019-11-22 10:15:18 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2019-11-22 10:15:18 +0100 |
commit | 4fd77927337b0243dac88ccb128af8268ea423f7 (patch) | |
tree | d39f90bcc1353da2e2520d08fe82d6d71e770f56 /sem1/algo/workshop2/dfs/graph.h | |
parent | 9eccc3f2f3f03ffdd9d7b985fecf7222bb956df3 (diff) |
Added hashtable for indexing vertexes
Diffstat (limited to 'sem1/algo/workshop2/dfs/graph.h')
-rw-r--r-- | sem1/algo/workshop2/dfs/graph.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sem1/algo/workshop2/dfs/graph.h b/sem1/algo/workshop2/dfs/graph.h index 67ac1dc..e169a8a 100644 --- a/sem1/algo/workshop2/dfs/graph.h +++ b/sem1/algo/workshop2/dfs/graph.h @@ -5,6 +5,8 @@ #define COLOR_GRAY 1 #define COLOR_BLACK 2 +#define HASHSIZE 128 + struct vertex_struct; // Linked list @@ -18,24 +20,25 @@ typedef struct edge_struct { } edge_t; typedef struct vertex_struct { - char ref; + char *ref; int color; int dtime; int ftime; - struct vertex_struct *p; edge_t *adj; + + // Hash table stuff + struct vertex_struct *next; } vertex_t; typedef struct { - vertex_t *vertexes[128]; - + vertex_t *hashtable[128]; } graph_t; int graph_to_dot(FILE *f, graph_t *g); -int graph_print_adj(graph_t *g, char ref); -void graph_edge(graph_t *g, char from, char to, int weight); +int graph_print_adj(graph_t *g, char *ref); +void graph_edge(graph_t *g, char *from, char *to, int weight); edge_t *edge_next(graph_t *g, edge_t *e); vertex_t *vertex_next(graph_t *g, vertex_t *v); |