当前位置: 首页>>代码示例>>C++>>正文


C++ UndirectedGraph::vertexCount方法代码示例

本文整理汇总了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;
}
开发者ID:vladimirkroupa,项目名称:mi-par,代码行数:55,代码来源:main.cpp


注:本文中的UndirectedGraph::vertexCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。