forked from doctor-phil/network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvertex.h
More file actions
52 lines (42 loc) · 1.18 KB
/
Copy pathvertex.h
File metadata and controls
52 lines (42 loc) · 1.18 KB
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
/*
* This vertex.h file provides the forward declarations for the vertex.c file.
*/
#ifndef __VERTEX_HEADER
#define __VERTEX_HEADER
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "linked_list.h"
typedef struct _Vertex
{
LinkedList* arcList;
void* data;
bool visited;
float distance;
struct _Vertex* parent;
} Vertex;
typedef struct _Arc
{
Vertex* vertex;
float weight;
} Arc;
Vertex* create_vertex(void*);
bool add_vertex_arc(Vertex*, Vertex*, float);
bool remove_vertex_arc(Vertex*, Vertex*);
void* get_data(Vertex*);
LinkedList* get_arc_list(Vertex*);
bool been_visited(Vertex*);
void set_visited(Vertex*, bool);
float get_weight(Vertex*, Vertex*);
bool change_vertex_weight(Vertex*, Vertex*, float);
void set_vertex_distance(Vertex*, float);
float get_vertex_distance(Vertex*);
void set_vertex_parent(Vertex*, Vertex*);
Vertex* get_vertex_parent(Vertex*);
bool has_arc_to_vertex(Vertex*, Vertex*);
Arc* create_arc(Vertex*, float);
void set_arc_weight(Arc*, float);
void set_vertex(Arc*, Vertex*);
float _get_arc_weight(Arc*);
Vertex* get_arc_vertex(Arc*);
#endif