本文整理汇总了C++中UndirectedGraph::vertexCount方法的典型用法代码示例。如果您正苦于以下问题:C++ UndirectedGraph::vertexCount方法的具体用法?C++ UndirectedGraph::vertexCount怎么用?C++ UndirectedGraph::vertexCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UndirectedGraph
的用法示例。
在下文中一共展示了UndirectedGraph::vertexCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
int i;
if (argc != 2) {
cout << "Spatny pocet parametru" << endl;
cout << "binarka nazev-souboru" << endl;
cout << std::endl << "Arguments:" << endl;
exit(EXIT_FAILURE);
}
UndirectedGraph *graph = readGraphFromFile(argv[1]);
cout << "vertex count=" << graph->vertexCount() << endl;
DFSSolver *solver = new DFSSolver(graph);
//time start
//time_t start = time(NULL);
//TimeTool(time(NULL)) start;
TimeTool start(time(NULL));
//hledani reseni
pair<vector<Edge> *, int> *result = solver->findBestSolution();
//time end
//time_t end = time(NULL);
TimeTool end(time(NULL));
vector<Edge> *solution = result->first;
int solutionPrice = result->second;
if (solution != NULL) {
cout << "Best solution:" << endl;
for (i = 0; i < solution->size(); i++) {
cout << (*solution)[i] << endl;
}
cout << "Spanning tree degree: " << solutionPrice << endl;
}
//Celkovy cas vypoctu
//double dif = difftime(end, start);
//int h = dif/3600;
//int m = dif /60;
//int s = dif - (h * 3600) - (m * 60);
//cout << "DIFF:" << dif << "s" << endl;
//cout << "TIME:" << h << ":" << m << ":" << s << " input file " << argv[1] << endl;
TimeTool dif (difftime(end.time, start.time));
//cout << "TIME: " << dif << " input file " << argv[1] << " START:" << start <<" END:" << end << endl;
cout << "TIME: " << dif << " input file " << argv[1] << endl;
delete graph;
delete solution;
delete result;
delete solver; // tady to umre
return 0;
}