View Single Post
  #4 (permalink)  
Old June 8th, 2004, 12:28 PM
gbilios gbilios is offline
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote