i got it working
thanks anyway
i wrote the function(s), tested and thats all
void dfs(struct graph *graph)
{
struct node *node;
for(node = graph->node_list; node != NULL; node = node->next)
{
/* process from node A */
if(strcmp(node->label,"A")==0)
dfs_visit_node(node);
}
} /* dfs() */
void dfs_visit_node(struct node *node)
{
struct arc *arc;
printf(" %s ", node->label);
node->visited = TRUE;
for(arc = node->arc_list; arc != NULL; arc = arc->next)
{
if(arc->dest_node->visited != TRUE)
{
dfs_visit_node(arc->dest_node);
}
}
} /* dfs_visit_node() */
gbilios
|