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") {
37 int n = countNodes(g);
38 int source = rand() % n;
39 cout <<
"Source node: " << source << endl;
40 cout <<
"Total nodes: " << n << endl;
41 cout <<
"Total edges: " << countEdges(g) << endl;
44 cout <<
"Using greedy nearest:" << endl;
50 cout <<
"Max colours: " << greedyNearest.maxK() << endl;
51 cout <<
"Colours used: " << greedyNearest.totalColours() << endl;
52 cout <<
"LCA value: " << greedyNearest.lcaValue() << endl;
55 cout <<
"Could not find a solution!" << endl;
59 cout <<
"Using greedy nearest random:" << endl;
61 greedyNearestRnd.p(atof(argv[3]));
62 greedyNearestRnd.seed(time(NULL));
63 greedyNearestRnd.init();
67 cout <<
"Max colours: " << greedyNearestRnd.maxK() << endl;
68 cout <<
"Colours used: " << greedyNearestRnd.totalColours() << endl;
69 cout <<
"LCA value: " << greedyNearestRnd.lcaValue() << endl;
72 cout <<
"Could not find a solution!" << endl;
GraphFormat
Available graph formats.
int main(int argc, char **argv)
Main function.
void readGraph(Graph &g, GraphFormat f=RMF, IS &in=std::cin)
Read a graph.
void setSourceNode(const Node &v)
Set source node.
Solution has been found after running.
Default namespace Default namespace for MinLCA algorithms.
Class for greedy algorithms using a breadth-first search.
Functions for reading graphs and getting graph properties.
Definitions of randomised greedy algorithms.
Namespace for util functions and classes.