-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxnumber.cpp
More file actions
38 lines (29 loc) · 1007 Bytes
/
xnumber.cpp
File metadata and controls
38 lines (29 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <gdraw/io.hpp>
#include <gdraw/draw.hpp>
#include <gdraw/xnumber.hpp>
#include <boost/graph/adjacency_list.hpp>
using AdjList = boost::adjacency_list<
boost::vecS
,boost::vecS
,boost::undirectedS
,boost::property<boost::vertex_index_t,int>
,boost::property<boost::edge_index_t,int>
>;
int main(int argc, char *argv[]){
if(argc != 2) {
std::cout << "Usage: ./xnumber <k> < <graph>" << std::endl;
std::cout << "Where <k> is the queried crossing number and <graph> is the DOT format graph file." << std::endl;
std::cout << "If the crossing number of <graph> is <= <k> the output will be a graph in DOT format with the drawing." << std::endl;
return 0;
}
int k = atoi(argv[1]);
//std::cin >> k;
auto g = gdraw::IndexedGraph<AdjList>{gdraw::readDOT<AdjList>()};
auto n = num_vertices(g.getGraph());
auto result = gdraw::planarXNumber(std::move(g),k);
if(result){
auto dg = gdraw::drawFlattenedGraph(std::move(result.value()),n);
gdraw::writeDOT(dg);
}
return 0;
}