-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary.h
More file actions
32 lines (27 loc) · 741 Bytes
/
library.h
File metadata and controls
32 lines (27 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef PATHFINDING
#define PATHFINDING
#include <stdio.h>
typedef enum {
FILE_NOT_FOUND = 1,
NO_START_NODE = 2,
NO_END_NODE = 3,
NO_VALID_PATH = 4,
BAD_FILE_FORMAT = 5
} Error;
typedef struct Node {
int id;
int links_count;
struct Node **links;
} Node;
void parse_nodes_file(FILE* file);
int nodes_quantity(FILE* file);
int nodes_links_quantity(FILE* file);
int node_start(FILE* file);
int node_end(FILE* file);
Node** init_nodes(char* filename);
void init_graph(Node **nodes);
void read_links(FILE* file, Node** nodes);
Node* get_node_by_id(Node **nodes, int id);
void display_nodes(Node *start, Node **visited, int *visited_count);
int is_visited(Node *node, Node **visited, int visited_count);
#endif