-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vertex.h
82 lines (74 loc) · 1.68 KB
/
Vertex.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef VERTEX_H
#define VERTEX_H
#ifndef NULL
#define NULL 0
#endif
#include "Edge.h"
class Vertex
{
private:
// the key of this vertex
int m_key;
// the number of the edges from this vertex to others
int m_size;
// the head pointer for the linked list of the edges
Edge* m_pEHead;
// the next pointer for the linked list of the vertics
Vertex* m_pNext;
public:
Vertex();
Vertex(int key);
~Vertex();
/// <summary>
/// set the next pointer of this vertex
/// </summary>
void SetNext(Vertex* pNext);
/// <summary>
/// get the key of this vertex
/// </summary>
///
/// <returns>
/// the key of this vertex
/// </returns>
int GetKey() const;
/// <summary>
/// get the next pointer of this vertex
/// </summary>
///
/// <returns>
/// the next pointer of this vertex
/// </returns>
Vertex* GetNext() const;
/// <summary>
/// get the number of the edges
/// </summary>
///
/// <returns>
/// the number of the edges
/// </returns>
int Size() const;
/// <summary>
/// add edge with edgeNum at the end of the linked list for the edges
/// </summary>
///
/// <param name="edgeKey">
/// the key of the vertex for the edge
/// </param>
/// <param name="weight">
/// the weight of the edge
/// </param>
void AddEdge(int edgeKey, int weight);
/// <summary>
/// get the head pointer of the edge
/// </summary>
///
/// <returns>
/// the ehad pointer of the edge
/// </returns>
Edge* GetHeadOfEdge() const;
/// <summary>
/// memory free for edges
/// </summary>
void Clear();
};
#endif