Commit | Line | Data |
---|---|---|
fa5222dc JB |
1 | #ifndef GRAPHS_H |
2 | #define GRAPHS_H | |
3 | ||
4 | #include <stdbool.h> | |
5 | #include <stddef.h> | |
6 | ||
7 | #include "list.h" | |
8 | ||
9 | /* number of nodes or vertices or points */ | |
10 | //const unsigned int num_nodes = 10; | |
11 | #define num_nodes 5 | |
12 | ||
13 | /* Adjacency matrix */ | |
14 | /* for a valued graph */ | |
15 | int M[num_nodes][num_nodes]; | |
16 | /* for an oriented graph */ | |
17 | //bool M[num_nodes][num_nodes]; | |
18 | ||
19 | /* Adjacency list */ | |
20 | typedef struct succ_list_s { | |
21 | unsigned int num_node; | |
22 | int val; | |
23 | struct list_head list; | |
24 | } succ_list_t; | |
25 | //succ_list_t* nodes[num_nodes] = { NULL }; | |
26 | ||
27 | void display_adj_matrix(int adj_matrix[num_nodes][num_nodes]); | |
28 | void convert_adj_matrix_to_adj_lists(int adj_matrix[num_nodes][num_nodes], succ_list_t* nodes[num_nodes]); | |
29 | void display_adj_lists(succ_list_t* nodes[num_nodes]); | |
30 | ||
31 | #endif |