-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgdt.cpp
39 lines (36 loc) · 891 Bytes
/
gdt.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
#include <iostream>
#include <fstream>
#include "Graph.hpp"
void createGraph(Graph &g, std::string filename, std::string params)
{
std::ofstream file;
file.open(filename);
file << "graph G {\n";
file << params << "\n";
file << "node [shape=circle];\n";
// Print all vertices.....
for (int i = 0; i < g.VertexNumber; i++)
{
file << i << ";\n";
}
// Print all edges......
for (int i = 0; i < g.VertexNumber; i++)
{
for (int j = i; j < g.VertexNumber; j++)
{
if (g.isEdge(i, j))
{
file << i << " -- " << j << ";\n";
}
}
}
file << "}";
}
int main()
{
Graph g = completeGraph(4);
std::cout << "H_1 = " << g.H_1() << std::endl;
// createGraph(g, "graph.dot", "layout=circo");
// system("dot -Tpng graph.dot -o graph.png");
return 0;
}