-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
191 lines (182 loc) · 3.79 KB
/
Copy pathmain.cpp
File metadata and controls
191 lines (182 loc) · 3.79 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#include <iostream>
#include "myGraph.h"
using namespace std;
int main() {
cout << "WELCOME TO THE NETWORK SIMULATOR";
int input_var1, input_var2;
float input_var_f1;
string input_var1s, input_var2s;
myGraph_class a;
char choice;
GorN:
int ahg_1 = 0;
cout << "\nPress * G * to access functinalities of Graph class:\n";
cout << endl;
cout << "\nPress * N * to access functinalities of Network class:\n";
cout << "!!!!!!!!! CASE SENSITIVE !!!!!!!!!\n";
cout << endl;
cin >> choice;
switch (choice)
{
case 'G':
{
while (ahg_1 == 0)
{
int opt;
cout << "Press 1: to Add Vertex\n";
cout << "Press 2: to Add Edge\n";
cout << "Press 3: to Remove Vertex\n";
cout << "Press 4: to Remove Edge\n";
cout << "Press 5: to Show Gra ph\n";
cout << "Press 6: to Get NUmberof Vertices\n";
cout << "Press 7: to Get Number of Links\n";
cout << "Press 8: to Check if graph is empty\n";
cout << "Press 9: to access network class\n";
cin >> opt;
switch (opt)
{
case 1:
{
cout << "Enter String of your choice as vertex name" << endl;
cin >> input_var1s;
a.addVertex(input_var1s);
break;
}
case 2:
{
cout << "Enter Edge1 of your choice" << endl;
cin >> input_var1s;
cout << "Enter Edge2 of your choice" << endl;
cin >> input_var2s;
cout << "Enter weight of your choice" << endl;
cin >> input_var_f1;
a.addEdge(input_var1s, input_var2s, input_var_f1);
break;
}
case 3:
{
cout << "Enter vertex of your choice to remove" << endl;
cin >> input_var1s;
a.deleteVertex(input_var1s);
break;
}
case 4:
{
cout << "Enter Edge1 of your choice" << endl;
cin >> input_var1s;
cout << "Enter Edge2 of your choice" << endl;
cin >> input_var2s;
a.deleteEdge(input_var1s, input_var2s);
break;
}
case 5:
{
a.showData();
break;
}
case 6:
{
cout << a.getNumVertices() << endl;
break;
}
case 7:
{
cout << a.getNumLinks() << endl;
break;
}
case 8:
{
if (a.isEmpty())
cout << "EMPTY" << endl;
else
cout << "Not empty" << endl;
break;
}
case 9:
{
goto GorN;
break;
}
default:
cout << "WRONG OPTION SELECTED" << endl;
goto GorN;
break;
}
cout << "ENTER 1 to STOP AND 0 TO PERFORM MORE OPERATIONS" << endl;
cin >> ahg_1;
}
case 'N':
{
int ahg = 0;
cout << "calculating the unit disk areas and establishing links" << endl;
cout << "ENTER THE AREA OF YOUR CHOICE" << endl;
cin >> input_var1;
cout << "ENTER THE NUMBER OF NODES OF YOUR CHOICE" << endl;
cin >> input_var2;
wireless wireless_1(input_var1, input_var2);
cout << endl;
while (ahg == 0)
{
int opt2;
cout << endl;
cout << "Press 1: To show graph \n";
cout << "Press 2: To Make network \n";
cout << "Press 3: For shortest path \n";
cout << "Press 4: For BFS \n";
cout << "Press 5: For DFS \n";
cout << "Press 6: to access graph class \n";
cin >> opt2;
switch (opt2)
{
case 1:
{
wireless_1.showDatas();
cout << endl;
break;
}
case 2:
{
wireless_1.networkmaker();
cout << endl;
break;
}
case 3:
{
wireless_1.shortest_path();
cout << endl;
break;
}
case 4:
{
cout << "Enter node of your choice" << endl;
cin >> input_var1;
wireless_1.BFS(input_var1);
cout << endl;
break;
}
case 5:
{
cout << "Enter node of your choice" << endl;
cin >> input_var1;
wireless_1.DFS(input_var1);
cout << endl;
break;
}
case 6:
{
goto GorN;
break;
}
default:
cout << "WRONG OPTION SELECTED" << endl;
goto GorN;
break;
}
cout << "ENTER 1 to STOP AND 0 TO PERFORM MORE OPERATIONS" << endl;
cin >> ahg;
}
}
}
}
system("pause");
}