-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphM.hpp
57 lines (42 loc) · 903 Bytes
/
GraphM.hpp
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
#ifndef GRAPHM_HPP_
#define GRAPHM_HPP_
#include "list\dlist.hpp"
#include "matrix\matrix.hpp"
template <typename T, typename W>
class GraphM
{
public:
struct Edge;
struct Vertex;
Matrix<int> adjency_matrix;
dlinklist<Edge*> edge_list;
dlinklist<Vertex*> vertex_list;
int vertices_idx;
Vertex* insertVertex(W O)
{
Vertex* vertex_tmp = new Vertex;
vertex_tmp->data = O;
vertex_tmp->idx = vertices_idx;
vertices_idx++;
vertex_list.push(vertex_tmp);
return vertex_tmp;
}
Edge* insertEdge(Vertex* V_start, Vertex* V_end, W O)
{
Edge* edge_tmp = new Edge;
edge_tmp->weight = O;
}
void AdjencyMatrix_display(void) {adjency_matrix.display();};
struct Vertex
{
W data;
int idx;
};
struct Edge
{
T weight;
struct Vertex* vertex_start;
struct Vertex* vertex_end;
};
};
#endif /* GRAPHM_HPP_ */