Push the WIP graphs handling code
[Algorithmic_C.git] / TP7 / exo1 / graphs.h
diff --git a/TP7/exo1/graphs.h b/TP7/exo1/graphs.h
new file mode 100644 (file)
index 0000000..734b96f
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef GRAPHS_H
+#define GRAPHS_H
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#include "list.h"
+
+/* number of nodes or vertices or points */
+//const unsigned int num_nodes = 10;
+#define num_nodes 5
+
+/* Adjacency matrix */
+/* for a valued graph */
+int M[num_nodes][num_nodes];
+/* for an oriented graph */
+//bool M[num_nodes][num_nodes];
+
+/* Adjacency list */
+typedef struct succ_list_s {
+    unsigned int num_node;
+    int val;
+    struct list_head list;
+} succ_list_t;
+//succ_list_t* nodes[num_nodes] = { NULL };
+
+void display_adj_matrix(int adj_matrix[num_nodes][num_nodes]);
+void convert_adj_matrix_to_adj_lists(int adj_matrix[num_nodes][num_nodes], succ_list_t* nodes[num_nodes]);
+void display_adj_lists(succ_list_t* nodes[num_nodes]);
+
+#endif