-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrac1_AdjList.cpp
43 lines (33 loc) · 1.23 KB
/
Prac1_AdjList.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
// Implement the graph operation for union, intersection,
// compliment and subtraction of the two different graphs
#include <iostream>
#include "UndirectedGraph.h"
using namespace std;
int main(){
cout << "GraphA" << endl;
UndirectedGraph graphA(4);
graphA.addEdge(0,1);
graphA.addEdge(1,2);
graphA.displayGraph();
cout << "GraphB" << endl;
UndirectedGraph graphB(4);
graphB.addEdge(1,2);
graphB.addEdge(2,3);
graphB.displayGraph();
cout << "UnionGraph" << endl;
UndirectedGraph UnionGraph = UndirectedGraph::Union(graphA, graphB);
UnionGraph.displayGraph();
cout << "IntersectionGraph" << endl;
UndirectedGraph IntersectionGraph = UndirectedGraph::Intersection(graphA, graphB);
IntersectionGraph.displayGraph();
cout << "GraphA - GraphB" << endl;
UndirectedGraph Subt_A_B = UndirectedGraph::Subtraction(graphA, graphB);
Subt_A_B.displayGraph();
cout << "GraphA (+) GraphB ... RingSum" << endl;
UndirectedGraph RingSum_A_B = UndirectedGraph::RingSum(graphA, graphB);
RingSum_A_B.displayGraph();
cout << "~GraphA" << endl;
UndirectedGraph Comp_A = graphA.Complement();
Comp_A.displayGraph();
return 0;
}