Newer
Older
#include "dfs.h"
void stack_enqueue(struct node *n, struct list_head *stack)
{
if (list_empty(stack))
INIT_LIST_HEAD(stack);
}
struct node *stack_dequeue(struct list_head *stack)
{
struct node *n;
if (list_empty(stack))
return NULL;
}
void add_visited(struct node *n, struct list_head *visited)
{
if (list_empty(visited))
INIT_LIST_HEAD(visited);
bool is_visited(char *path, struct list_head *visited) // just visited
{
struct node *tmp;
list_for_each_entry(tmp, visited, list) {
if (strncmp(tmp->path, path, 1024) == 0)
}
void clear_list(struct list_head *visited)
{
struct node *n, *tmp;
list_for_each_entry_safe(n, tmp, visited, list) {
free(n->path);
}
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);
}