-
Notifications
You must be signed in to change notification settings - Fork 0
/
finddpc.cpp
41 lines (29 loc) · 849 Bytes
/
finddpc.cpp
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
39
40
41
#include <iostream>
#include <string>
#include <gdraw/pplane.hpp>
#include <gdraw/io.hpp>
#include <gdraw/draw.hpp>
using AdjList = boost::adjacency_list<
boost::vecS
,boost::vecS
,boost::undirectedS
,boost::property<boost::vertex_index_t,size_t>
,boost::property<boost::edge_index_t,size_t>
>;
int main(){
using namespace gdraw;
auto g = IndexedGraph{readDOT<AdjList>()};
auto n = num_vertices(g.getGraph());
auto result = findDoublePlanarCover(std::move(g));
if(result){
auto dg = tuttePlanarDraw(std::move(result.value()));
std::vector<edge_t<AdjList>> xedges;
auto is_x_edge = [&dg,&n](auto&& e){
auto [u,v] = endpoints(dg.getGraph(),e);
return (u < n && v >=n) || (u >=n && v < n);
};
for(auto&& e : range(edges(dg.getGraph())) | std::views::filter(is_x_edge))
dg.colorEdge(e,"red");
writeDOT(dg);
}
}