J'utilisais le graphique boost et il semble que je ne le comprenne pas très bien.Boost-Graph Accéder à l'étiquette d'un bord
Pour accéder à l'étiquette d'un sommet, il semble que ce soit correct d'utiliser get (vertex_name, graph_), puis d'y accéder avec le []. Mais comment puis-je accéder à l'étiquette d'un bord.
J'ai essayé d'appliquer la même méthodologie (et beaucoup d'autres mauvaises choses) mais Je n'ai pas réussi à accéder à son étiquette.
Voici un extrait de mon code:
typedef property<edge_name_t, int> edge_property;
typedef property<vertex_name_t, int> vertex_property;
typedef adjacency_list<vecS, vecS, undirectedS, vertex_property, edge_property> MyGraph;
MyGraph graph_;
add_vertex(vertex_property(6), graph_);
add_vertex(vertex_property(1), graph_);
add_vertex(vertex_property(1), graph_);
add_edge(0, 1, edge_property(2), graph_);
add_edge(1, 2, edge_property(3), graph_);
add_edge(0, 2, edge_property(1), graph_);
cout << "Graph 1 [graph_]" << endl;
typedef graph_traits<MyGraph>::edge_iterator edge_iter;
pair<edge_iter, edge_iter> ep;
property_map<MyGraph, vertex_name_t>::type labelling_vertex = get(vertex_name, graph_);
property_map<MyGraph, edge_name_t>::type labelling_edge = get(edge_name, graph_);
int position = 0;
for (ep = edges(graph_); ep.first != ep.second; ++ep.first) {
unsigned int source_ = source(*ep.first, graph_);
unsigned int target_ = target(*ep.first, graph_);
cout << source_ << "["<< labelling_vertex[source_] <<"]" << " ~~~~" << labelling_edge[position] << "~~~~ " << target_ <<"[" <<labelling_vertex[target_] <<"]" << endl;
position++;
}