3 #include <lemon/smart_graph.h>
23 int main(
int argc,
char **argv)
25 GRAPH_TYPEDEFS(SmartGraph);
27 ifstream graphFile(argv[1]);
30 if (
string(argv[2]) ==
"GRA") {
36 int n = countNodes(g);
37 int source = rand() % n;
38 cout <<
"Source node: " << source << endl;
39 cout <<
"Total nodes: " << n << endl;
40 cout <<
"Total edges: " << countEdges(g) << endl;
43 cout <<
"Using greedy nearest:" << endl;
49 cout <<
"Max colours: " << greedyNearest.maxK() << endl;
50 cout <<
"Colours used: " << greedyNearest.totalColours() << endl;
51 cout <<
"LCA value: " << greedyNearest.lcaValue() << endl;
54 cout <<
"Could not find a solution!" << endl;
60 cout <<
"Using greedy LP:" << endl;
63 greedyLp.setSourceNode(g.nodeFromId(source));
66 cout <<
"Max colours: " << greedyLp.maxK() << endl;
67 cout <<
"Colours used: " << greedyLp.totalColours() << endl;
68 cout <<
"LCA value: " << greedyLp.lcaValue() << endl;
71 cout <<
"Could not find a solution!" << endl;
GraphFormat
Available graph formats.
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.
int main(int argc, char **argv)
Main function.
Use the MinLCAGreedyLp with Bfs.
Definitions for the greedy algorithms using linear programming.
Namespace for util functions and classes.