I have three different vectors of objects that I need to make a tree structure from them. Let’s assume we have vector parents, vector children, and vector leaves. Therefore, each member of vector children has several children that sits at the end of the tree as leaves, and has one parent that sits as parents. What I am using is defining Vertex properties and Edges properties as below, and then define a bidirectional graph:struct VertexData
std::string obj_name; // concatenation of labels
typedef boost::adjacency_list<:vecs boost::vecs="" boost::bidirectionals="" vertexdata="" boost::property="" double="" edgedata=""> > Graph;
What I am doing currently, is looping through the vector leaves, for each member, I find the parent and make an edge. Then assign properties to the edge and vertices. But then for next leaf, I should check if already it has a parent in the tree or I should add a new vertex for its parent. Another thing that I tried, was looping through the vector children, and for each member try to make its leaves and parent. But I am not sure what is the correct way to do this. Here is a link: adding custom vertices to a boost graph that I try to do the same but with iterations.