我有以下cpp文件:
#include <iostream> // for std::cout
#include <utility> // for std::pair
#include <algorithm> // for std::for_each
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/graphviz.hpp>
using namespace boost;
using namespace std;
int main(int,char*[])
{
// create a typedef for the Graph type
typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
// declare a graph object
Graph g();
dynamic_properties dp;
ifstream dotfile ("./a1.dot");
read_graphviz(dotfile,g, dp);
return 0;
}
其中a1.dot
是:
digraph G {
graph [bb="0,0,147,324"];
node [label="\N"];
0 [height=0.5,
pos="82,306",
width=0.75];
1 [height=0.5,
pos="27,234",
width=0.75];
0 -> 1 [pos="e,38.911,250.16 70.066,289.81 62.786,280.55 53.337,268.52 45.146,258.09"];
3 [height=0.5,
pos="65,162",
width=0.75];
0 -> 3 [pos="e,67.058,180.19 79.949,287.87 77.052,263.67 71.729,219.21 68.279,190.39"];
1 -> 3 [pos="e,56.234,179.15 35.813,216.76 40.418,208.28 46.155,197.71 51.321,188.2"];
2 [height=0.5,
pos="120,90",
width=0.75];
2 -> 0 [pos="e,85.045,287.85 116.99,107.94 110.42,144.92 94.75,233.2 86.8,277.97"];
4 [height=0.5,
pos="92,18",
width=0.75];
2 -> 4 [pos="e,98.588,35.47 113.36,72.411 110.09,64.216 106.06,54.14 102.38,44.955"];
3 -> 2 [pos="e,108.09,106.16 76.934,145.81 84.214,136.55 93.663,124.52 101.85,114.09"];
3 -> 4 [pos="e,88.732,36.189 68.257,143.87 72.858,119.67 81.312,75.211 86.791,46.393"];
}
我试图在cpp文件中打印pos属性,有人可以给我任何指示或告诉我它是如何完成的吗?
谢谢?