-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path그래프구현.cpp
73 lines (64 loc) · 813 Bytes
/
그래프구현.cpp
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
#include <iostream>
#include <vector>
using namespace std;
#define INF 99999999
class vertex
{
public:
int degree;
int data;
vertex()
{
degree = 0;
data = 0;
}
vertex(int v)
{
data = v;
degree = 0;
}
};
class edge
{
public:
vertex* prev;
vertex* next;
edge()
{
this->prev = NULL;
this->next = NULL;
}
};
class graph
{
public:
vertex* vlist[501];
edge* elist[1001];
graph()
{
for (int i = 0; i < 501; i++)
{
vlist[i] = NULL;
}
for (int i = 0; i < 1001; i++)
{
elist[i] = NULL;
}
}
void insertV(int v)
{
if (vlist[v] != NULL) return;
vertex* newv = new vertex(v);
vlist[v] = newv;
}
void insertE(int v1, int v2)
{
if (vlist[v1] == NULL || vlist[v2] == NULL) return;
}
};
int main()
{
cin.tie(NULL);
ios::sync_with_stdio(false);
return 0;
}