I want to export a vector which is storing sequence of string values to boost graph(dot file). . The last four lines can explain the problem/help required. I know the code is wrong, but need guidlines to address this issue. I want to store vector toponodedist2 to graph dot file.Here I want store an array/vector which will store the sequence of values at indexes like (image01, image02, iamge 03 ....). later I will export this vector via write_graphviz_dp to dot file. Thanks
#include<iostream>
#include<boost/graph/adjacency_list.hpp>
#include<boost/graph/graphviz.hpp>
#include<boost/graph/properties.hpp>
#include<boost/graph/property_maps/container_property_map.hpp>
#include<boost/graph/named_function_params.hpp>
#include <cstdlib>
#include<fstream>
struct VertexData
{
std:: string image_path;
int id;
int image_num;
std:: vector<std::vector<std::string>> toponodedist2;
};
int main(int,char*[])
{
VertexData v11;
std:: vector<std::vector<std::string>> toponodedist;
std:: vector<std::string> toponodedist1;
toponodedist1.push_back("this");
toponodedist1.push_back("This is first node2");
toponodedist1.push_back("This is first node3");
v11.toponodedist2.push_back(toponodedist1);
toponodedist.push_back(toponodedist1);
toponodedist1.clear();
toponodedist1.push_back("This is first node1");
toponodedist1.push_back("This is first node2");
toponodedist1.push_back("This is first node3");
toponodedist.push_back(toponodedist1);
v11.toponodedist2.push_back(toponodedist1);
for(int i=0;i<=2;i++)
for(int j=0;j<=2;j++)
std::cout<< "this is "<<v11.toponodedist2[i][j]<<std::endl;
/// mention vertex data in declaring adjacency list
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VertexData,boost::no_property> MyGraphType;
MyGraphType G;
auto v1 =add_vertex(G);
auto v2 =add_vertex(G);
auto v3 =add_vertex(G);
auto v4 =add_vertex(G);
auto v5 =add_vertex(G);
auto v6 =add_vertex(G);
auto v7 =add_vertex(G);
auto v8 =add_vertex(G);
auto v9 =add_vertex(G);
auto e1 =add_edge(v1,v2,G);
auto e2 =add_edge(v2,v3,G);
auto e3 =add_edge(v3,v4,G);
auto e4 =add_edge(v4,v5,G);
auto e5 =add_edge(v5,v6,G);
auto e6 =add_edge(v7,v7,G);
auto e7 =add_edge(v5,v2,G);
auto e8 =add_edge(v1,v4,G);
auto e9 =add_edge(v3,v7,G);
auto e10 =add_edge(v2,v7,G);
auto e11 =add_edge(v2,v6,G);
auto vpair=vertices(G);
int numberOfInEdges = boost::out_degree(8,G);
std::cout<< "The number of vertices are "<<numberOfInEdges;
;
std::ofstream dotfile1;
dotfile1.open("dotgraph1.txt", std::ios::app);
boost::dynamic_properties dp;
dp.property("node_id", get(&VertexData::id, G));
// this is the place where I need help to export toponodeist2 to graph dot
// file ditfile1, but I am not able to do it. thanks
dp.property("path_Ismage", get(&VertexData::toponodedist2, G));
/// the line need to be addressed
boost::write_graphviz_dp(dotfile1,G,dp);
dotfile1.close();
return 0;
}