나는이BGL 에지 번들 속성
class cVertex { ... };
class eEdge { ... };
typedef boost::adjacency_list <
boost::vecS, boost::vecS, boost::undirectedS,
cVertex, cEdge >
graph_t;
graph_t myGraph;
처럼 번들 속성을 사용하여이 정점에 대해 잘 작동입니다. 나는 쉽게
const cVertex& v = myGraph[ *vertices(myGraph).first + idx ];
그러나, 같은 일이 가장자리를 위해 작동하지 않는 것 정점 번들 속성에 액세스하는 코드를 작성할 수 있습니다
const cEdge& e = myGraph[ *edges(myGraph).first + idx ];
내가 얻을이 컴파일러 오류
1>.\cGraph.cpp(109) : error C2678: binary '+' :
no operator found which takes a left-hand operand of type
'boost::detail::edge_desc_impl<Directed,Vertex>'
(or there is no acceptable conversion)
나는 또한 이것을 시도했다 :
정점 0이 잘
boost::graph_traits<graph_t>::vertex_iterator vi = vertices(myGraph).first;
vi += idx;
작동하지만 내가이 해결
boost::graph_traits<graph_t>::edge_iterator ei = edges(myGraph).first;
for(int k = 0; k < idx; k++) {
ei++;
}
그것을 발견
>C:\boost\boost_1_51\boost/iterator/iterator_adaptor.hpp(330) :
error C3767: '+=': candidate function(s) not accessible
1> could be the friend function at 'C:\boost\boost_1_51\boost/graph/topology.hpp(63)' :
'+=' [may be found via argument-dependent lookup]
왜 인덱스로 가장자리에 액세스하려고합니까? 이것이 문제입니다. 반복자와 반대되는 가장자리 설명자를 특정 단계만큼 진행할 방법이 없습니다. –
그래서 나는 다음과 같은 질문에 답할 수 있습니다 : 15 번째 가장자리에 번들 속성 x의 값은 무엇입니까? 특히, 사용자에게 가장자리 속성 표를 제시하고 개별 가장자리 속성의 값을 변경할 수있게합니다. 테이블 위젯은 제 15 가장자리의 속성 값이 방금 변경되었음을 알려줍니다. – ravenspoint
그런 경우, 가장자리 디스크립터를 포함하는 별도의 색인 화 가능 데이터 구조 (예 :'std :: vector')를 원할 수 있습니다. –