Ticket #7502: quadratic.cpp

File quadratic.cpp, 473 bytes (added by Jan Hązła <jan.hazla@…>, 10 years ago)

Graph generator that breaks time complexity of planarity test.

Line 
1#include <iostream>
2#include <boost/graph/adjacency_list.hpp>
3#include <boost/graph/boyer_myrvold_planar_test.hpp>
4using namespace std;
5using namespace boost;
6
7typedef adjacency_list<vecS, vecS, undirectedS> Graph;
8
9int main() {
10 int N;
11 cin >> N;
12
13 Graph G(N+2);
14 for (int u = 1; u <= N; ++u)
15 add_edge(0, u, G);
16 for (int u = 1; u < N; ++u)
17 add_edge(u, u+1, G);
18 for (int u = 0; u <=N; ++u)
19 add_edge(u, N+1, G);
20 cout << boyer_myrvold_planarity_test(G) << "\n";
21}