Commit fc178ff5 authored by Nghia Truong's avatar Nghia Truong
Browse files

STYLE: Add comments and commandline option for Graph example

parent 0d3f42f4
......@@ -23,14 +23,20 @@
#include "imstkTetrahedralMesh.h"
#include "imstkMeshIO.h"
#include <iostream>
using namespace imstk;
///
/// \brief This example demonstrates the imstk graph usage
/// Usage: Example-Graph.exe [method=greedy/welsh-powell]
/// (if no method was specified, WelshPowell method will be used)
///
int main(int argc, char** argv)
{
// Using WelshPowell method by default
Graph::ColoringMethod method = Graph::ColoringMethod::WelshPowell;
if (argc > 1)
{
auto param = std::string(argv[1]);
......@@ -41,10 +47,17 @@ int main(int argc, char** argv)
{
method = Graph::ColoringMethod::Greedy;
}
// else: no need to set
else if (param.substr(param.find_first_of("=") + 1) == "welsh-powell")
{
method = Graph::ColoringMethod::WelshPowell;
}
}
}
std::cout << (method == Graph::ColoringMethod::Greedy ?
"Graph coloring method: Greedy" :
"Graph coloring method: WelshPowell" ) << std::endl << std::endl;
Graph g1(5);
g1.addEdge(0, 1);
g1.addEdge(0, 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment