2 #include <lemon/smart_graph.h>
24 int main(
int argc,
char **argv)
26 GRAPH_TYPEDEFS(SmartGraph);
28 ifstream graphFile(argv[1]);
31 if (
string(argv[2]) ==
"GRA") {
40 cout <<
"Graph reading time: " << timer.
elapsed() << endl;
43 int n = countNodes(g);
44 cout <<
"Total nodes: " << n << endl;
45 cout <<
"Total edges: " << countEdges(g) << endl;
46 cout <<
"Reading seed: " << argv[3] << endl;
49 cout <<
"Using greedy nearest:" << endl;
52 cout <<
"Creation elapsed time: " << greedyNearest.
creationTime() << endl;
54 cout <<
"Initialisation elapsed time: " << greedyNearest.
initTime() << endl;
57 cout <<
"Algorithm running time: " << greedyNearest.
runTime() << endl;
58 cout <<
"Max colours: " << greedyNearest.maxK() << endl;
59 cout <<
"Colours used: " << greedyNearest.totalColours() << endl;
60 cout <<
"LCA value: " << greedyNearest.lcaValue() << endl;
63 cout <<
"Could not find a solution!" << endl;
68 cout <<
"Using greedy least cost:" << endl;
71 cout <<
"Creation elapsed time: " << greedyLeastCost.
creationTime() << endl;
72 greedyLeastCost.
init();
73 cout <<
"Initialisation elapsed time: " << greedyLeastCost.
initTime() << endl;
76 cout <<
"Algorithm running time: " << greedyLeastCost.
runTime() << endl;
77 cout <<
"Max colours: " << greedyLeastCost.maxK() << endl;
78 cout <<
"Colours used: " << greedyLeastCost.totalColours() << endl;
79 cout <<
"LCA value: " << greedyLeastCost.lcaValue() << endl;
82 cout <<
"Could not find a solution!" << endl;
GraphFormat
Available graph formats.
double runTime()
Retrieve the duration of running the algorithm.
virtual MinLCAStatus run()
Run the algorithm.
Solution has been found after running.
Default namespace Default namespace for MinLCA algorithms.
Class for timing MinLCA algorithms.
Functions for reading graphs and getting graph properties.
double initTime()
Retrieve the duration of initialising the algorithm.
int main(int argc, char **argv)
Main function.
double creationTime()
Retrieve the duration of instantiating the algorithm class.
Contains the definitions for timing MinLCA algorithms.
double elapsed() const
Retrieve elapsed time.
void readGraphRandomOrder(Graph &g, int seed=0, GraphFormat f=RMF, IS &in=std::cin)
Read a graph in random order.
void init(Args &&...args)
Reset the data structures of the algorithm.
Namespace for util functions and classes.