[graph] edge container for fast indexing by (bundled) property
Hello! I have a question about Graph library. Let say I have a tree. Nodes of it are english letters. For example, A-->B-->X-->C, +-->A +-->D-->X I want to find sub-node of any node, by specifying the letter. Is it possible? For example, I'am in node B. And I want to find edge and node, by just saying "give me sub-node from B to the letter D". Looks like I have to write own EdgeContainer? Now I did it silly check every sub-node: *** typedef adjacency_list<listS,listS,bidirectionalS,NodeData> Lattice; typedef Lattice::vertex_descriptor VertexDesc; typedef Lattice::edge_descriptor EdgeDesc; std::tuple<bool,VertexDesc,EdgeDesc> get_sub_letter(const VertexDesc &n,char letter,const Lattice &lat) { auto outs=out_edges(n,lat); auto it=outs.first; for (;it!=outs.second;++it) { VertexDesc targetNode=target(*it,lat); if (lat[targetNode].letter==letter) return std::make_tuple(true,targetNode,*it); } return std::make_tuple(false,5,n,*it); } ***
participants (1)
-
al.zatv