testbtmaxclique.cpp

来自「《数据结构、算法与应用》从C++语言应用角度列举了要点」· C++ 代码 · 共 36 行

CPP
36
字号
// test adjacencyGraph::btMaxClique

#include <iostream>
#include <iterator>
#include "adjacencyGraph.h"

using namespace std;

void main(void)
{
   const int n = 7;
   adjacencyGraph g(n);

   // input a test graph
   cout << "Enter number of edges in 7 vertex graph"<< endl;
   int e;
   cin >> e;
   for (int i = 1; i <= e; i++)
   {
      cout << "Enter unweighted edge " << i << endl;
      int u, v;
      cin >> u >> v;
      g.insertEdge(new unweightedEdge(u, v));
   }

   cout << "The undirected graph is" << endl;
   g.output(cout);

   // test btMaxClique
   int *v = new int [n + 1];
   cout << "\nMax Clique size is " << g.btMaxClique(v) << endl;
   cout << "\nSolution vector is ";
   copy(v + 1, v + n + 1, ostream_iterator<int>(cout, "  "));
   cout << endl;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?