-
Notifications
You must be signed in to change notification settings - Fork 0
/
maze_graph_bridge.h
59 lines (49 loc) · 1.29 KB
/
maze_graph_bridge.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef KS_MAZE_SOLVER_GRAPH_BRIDGE
#define KS_MAZE_SOLVER_GRAPH_BRIDGE
#include "graph/maze_graph.h"
struct node_list
{
struct node *pixel_node;
};
/**
* The head of the node list that holds the (pixel, node) pairs.
*/
extern struct node_list **np_list;
/**
* Tracks the number of entries in 'np_list'
*/
extern unsigned np_list_vals;
/**
* Creates a new 'struct node_list' entry into 'np_list' for the given
* node.
*
* Returns 0 on success and non-zero value on failure.
*/
int insert_node(struct node *const n);
/**
* Remove the coressponding 'struct node_list' entry from the 'np_list'
* for the given pixel.
*
* Returns 0 on success and non-zero value on failure.
*
* TODO: Re-implement 'np_list' as a linked list to achieve this.
*/
int remove_node(unsigned pixel);
/**
* Free the memory taken up by the 'np_list'.
*/
void delete_np_list(void);
/*
* Gives the pointer to the graph node that represents the given pixel.
*
* Returns NULL if there is no node for the given pixel.
*/
struct node *get_node(unsigned pixel);
/*
* Adds 'adj_pixel_node' as an adjacency of 'pixel_node' and
* vice versa (as the graph is undirected).
*
* Returns 0 on success and non-zero value on error.
*/
int add_adjacency(struct node *const pixel_node, struct node *const adj_pixel_node);
#endif