1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
#include "Graph.h" |
8 |
|
|
|
9 |
|
|
///Test the graph conversion to dot |
10 |
|
1 |
void testGraphToDot(){ |
11 |
✓ |
2 |
Graph<bool, std::string> graph; |
12 |
|
|
|
13 |
✓ |
2 |
std::string nodeA("a"); |
14 |
✓ |
2 |
std::string nodeB("b"); |
15 |
✓ |
2 |
std::string nodeC("c"); |
16 |
✓ |
2 |
std::string nodeD("d"); |
17 |
✓ |
1 |
std::string nodeE("e"); |
18 |
|
|
|
19 |
|
|
//The first parameter is the data, second is the index and the third is the name |
20 |
✓✓ |
1 |
graph.createNode(true, nodeA, "var_" + nodeA); |
21 |
✓✓ |
1 |
graph.createNode(true, nodeB, "var_" + nodeB); |
22 |
✓✓ |
1 |
graph.createNode(true, nodeC, "var_" + nodeC); |
23 |
✓✓ |
1 |
graph.createNode(true, nodeD, "var_" + nodeD); |
24 |
✓✓ |
1 |
graph.createNode(true, nodeE, "var_" + nodeE); |
25 |
|
|
|
26 |
✓✓✓ |
1 |
graph.connectNode(nodeA, nodeC); |
27 |
✓✓✓ |
1 |
graph.connectNode(nodeB, nodeC); |
28 |
✓✓✓ |
1 |
graph.connectNode(nodeC, nodeE); |
29 |
✓✓✓ |
1 |
graph.connectNode(nodeD, nodeE); |
30 |
|
|
|
31 |
✓✓ |
1 |
graph.savePng("testGraph.png"); |
32 |
|
1 |
} |
33 |
|
|
|
34 |
|
|
|
35 |
|
1 |
int main(int argc, char** argv){ |
36 |
|
1 |
testGraphToDot(); |
37 |
|
1 |
return 0; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
|