#ifndef BFS_H
#define BFS_H

/*! \brief The type of a graph node */
typedef struct node {
  /*! The node id */
  unsigned int id;

  /* The nodes directly connected to this node */
  Neighbors_list neighbors;     

  /* Data used by the BFS algorithm: */
  enum {white, gray, black} color;

  /* A neighbor declared as parent in the tree */
  struct node *parent;

  /* The Neighbors declared as children in the tree */  
  Children_list children;
} Node;

/*! \brief The type of the graph */
typedef struct graph {
  /*! The graph nodes */
  Node *nodes;

  /*! The number of nodes in the graph */
  unsigned int size;
} Graph;

/*! \brief Initializes a graph */
void graph_init(Graph *graph, const char *file_name);

/*! \brief Clears a graph */
void graph_clear(Graph * graph);

/*! \brief Implements the Breath-First-Search algorithm */
void BFS(Graph * graph, Node * root);

/*! \brief Obtains a graph node by its id */
Node *get_node_by_id(Graph * graph, unsigned int id);

/*! \brief Prints a tree from root */
void tree_print(Node *root);

/*! \brief Clears the resources and exists with an error code */
void exit_error(char *err_msg);

/*! \brief Prints a concise message describing the command line */
void print_help(char * prog_name);

/*! \brief Reads a line from the input stream */
int get_line(FILE * stream, char * line, int size);

#endif
