Test your implementation on the following program dgdriver.cxx:
#include<iostream>
#include "digraph.h"
int main(int argc, char** argv) {
using namespace std;
string urlName1 = "name1";
string urlName2 = "name2";
string urlName3 = "name3";
URL* urlPtr1 = new URL(urlName1);
URL* urlPtr2 = new URL(urlName2);
URL* urlPtr3 = new URL(urlName3);
VertexURL* vtxURLPtr1 = new VertexURL(1, urlPtr1);
VertexURL* vtxURLPtr2 = new VertexURL(2, urlPtr2);
VertexURL* vtxURLPtr3 = new VertexURL(3, urlPtr3);
Vertex* vtxPtr1 = vtxURLPtr1;
Vertex* vtxPtr2 = vtxURLPtr2;
Vertex* vtxPtr3 = vtxURLPtr3;
vtxPtr1->addAdjacentVertexID(2);
vtxPtr1->addAdjacentVertexID(3);
vtxPtr2->addAdjacentVertexID(1);
vtxPtr3->addAdjacentVertexID(3);
Arc* arcPtr1 = new Arc(1,2);
Arc* arcPtr2 = new Arc(1,3);
Arc* arcPtr3 = new Arc(2,1);
Arc* arcPtr4 = new Arc(3,3);
TimeStamp t;
t.update();
Digraph G;
G.setTimeStamp(t);
G.addVertex(*vtxPtr1);
G.addVertex(*vtxPtr2);
G.addVertex(*vtxPtr3);
G.addArc(*arcPtr1);
G.addArc(*arcPtr2);
G.addArc(*arcPtr3);
G.addArc(*arcPtr4);
cout << G;
return 0;
}
and verify that the output is:
# graphviz output by WET (L. Liberti 2006)
digraph www_1158015497 {
0 [ label = "name1" ];
1 [ label = "name2" ];
2 [ label = "name3" ];
3 [ label = "Thu Jan 10 19:24:53 2008", color = red ];
1 -> 2;
1 -> 3;
2 -> 1;
3 -> 3;
}