lem_in/includes/lem_in.h
Tanguy MAZE ea0eda89d0 aaaaaaand it's done !
algorithm finished and normed
more testing might be needed
2019-04-03 17:20:29 +02:00

121 lines
2.8 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lem_in.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/23 17:31:19 by tmaze #+# #+# */
/* Updated: 2019/04/03 15:57:39 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef LEM_IN_H
# define LEM_IN_H
# include "libft.h"
# include <fcntl.h>
typedef struct s_node
{
char *name;
int x;
int y;
char role;
int ind;
struct s_node *next;
} t_node;
typedef struct s_ind
{
int index;
int weight;
struct s_ind *next;
} t_ind;
typedef struct s_lmdata
{
int nbants;
int nb_nodes;
t_list *nodes;
t_node *nodes_data;
t_ind **adj;
} t_lmdata;
typedef struct s_bfs
{
int parent;
char visited;
int queue;
} t_bfs;
//LEM_IN MT STRUCTS
typedef struct s_syntax
{
int nb_state;
int s_cmd;
int s_pos;
int s_vert;
int e_vert;
int gr_status;
int e_cmd;
int e_pos;
int v_flag;
} t_syntax;
typedef struct s_adjnode
{
int dest;
struct s_adjnode *next;
} t_adjnode;
typedef struct s_adjlist
{
t_adjnode *head;
} t_adjlist;
typedef struct s_graph
{
int vert;
t_adjlist *array;
} t_graph;
typedef struct s_neighbour
{
int vertnum;
struct s_neighbor *next;
} t_neighbor;
//MT-FUNCTIONS
int lm_error_exit(int flag);
int lm_parser(int fd, t_syntax *synt,
t_lmdata *ldata, t_graph *graph);
void lm_init_data(t_syntax *synt, t_lmdata *ldata);
void lm_add_vertex(t_lmdata *ldata, char *raw, char flag);
t_adjnode *lm_new_node(int dest);
t_graph *lm_creategraph(int v);
void lm_add_edge(t_graph *graph, int src, int dest);
void lm_ext_conn(t_graph *graph, t_lmdata *data, char *raw, t_syntax *synt);
int lm_find_index(t_lmdata *data, char *str);
void lm_initdata(t_lmdata *data);
int lm_getparams(t_lmdata *data);
t_ind *lst_indadd(t_ind **lst, int ind);
void lst_inddel(t_ind **lst);
void tablst_inddel(t_ind **tab);
void bfs(t_lmdata *data, t_bfs *tab, int start_ind, int end_ind);
t_ind **edmunds_karp(t_lmdata *data, int start_ind, int end_ind);
#endif