Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
68 lines (60 loc) · 1.49 KB
/
Copy pathmain.cpp
File metadata and controls
68 lines (60 loc) · 1.49 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
<<<<<<< Updated upstream
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <cassert>
#include <algorithm>
#include "Graph.h"
using namespace std;
int main() {
string filename = "g.txt";
auto *graph = new GraphSet;
try {
graph->createGraph(filename);
graph->printGraph();
if(graph->hasEdge(1,2))
cout<<"Edge (1,2) exists"<<endl;
auto ver = graph->adjVertex(1);
cout<<"The vertex connected to V1 are: ";
for(auto w : ver)
cout<<w<<" ";
cout<<endl;
cout<<"The degree of V1 is: ";
cout<<graph->degree(1)<<endl;
}
catch (const char* msg) {
cerr<<msg<<endl;
}
delete graph;
=======
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <cassert>
#include <algorithm>
#include "Graph.h"
using namespace std;
int main() {
string filename = "g.txt";
auto *graph = new GraphSet(filename);
try {
graph->createGraph(filename);
graph->printGraph();
if(graph->hasEdge(1,2))
cout<<"Edge (1,2) exists"<<endl;
auto ver = graph->adjVertex(1);
cout<<"The vertex connected to V1 are: ";
for(auto w : ver)
cout<<w<<" ";
cout<<endl;
cout<<"The degree of V1 is: ";
cout<<graph->degree(1)<<endl;
}
catch (const char* msg) {
cerr<<msg<<endl;
}
delete graph;
>>>>>>> Stashed changes
}