diff --git a/dfs.c b/dfs.c index a00a69535c6508fcfd32eed15e8aa821fa78ac09..2a4064f53875852d49835e4dbde5f8dc348e1830 100644 --- a/dfs.c +++ b/dfs.c @@ -60,4 +60,16 @@ void clear_list(struct list_head *visited) list_del(&n->list); free(n); } +} + +void print_list_dfs(struct list_head *collection_of_nodes_and_stuff) +{ + struct node *n; + + if (list_empty(collection_of_nodes_and_stuff)) + return; + + list_for_each_entry(n, collection_of_nodes_and_stuff, list) { + printf("path: %s\n", n->path); + } } \ No newline at end of file diff --git a/dfs.h b/dfs.h index f773fc2633af2c0bc19bc57f275a248354c0e588..f6d72c7a6e91169e986c0f38c8c43109cf13786c 100644 --- a/dfs.h +++ b/dfs.h @@ -13,4 +13,5 @@ struct node *stack_dequeue(struct list_head *stack); void add_visited(struct node *n, struct list_head *visited); bool is_visited(char *path, struct list_head *visited); void clear_list(struct list_head *visited); +void print_list_dfs(struct list_head *collection_of_nodes_and_stuff); #endif \ No newline at end of file