Boost logo

Boost Users :

Subject: [Boost-users] BGL edge iteration questions
From: David Doria (daviddoria_at_[hidden])
Date: 2011-06-06 18:17:01


1) When is it appropriate to use adjacency_list directly vs using
directed_graph and undirected_graph?

2) I am trying to iterate over the edges of a directed_graph:
http://codepad.org/jO3rJLtF

In the first method I tried:

typedef boost::graph_traits < Graph >::out_edge_iterator out_edge_iterator;
 std::pair<out_edge_iterator, out_edge_iterator> outEdges =
   boost::out_edges(v1, g);

, memory addresses seem to be output instead of vertex ids.

In the second method:

 typedef boost::property_map<Graph, boost::vertex_index_t>::type IndexMap;
 IndexMap index = get(boost::vertex_index, g);

, vertex ids are output, but I didn't specify if I wanted in edges or
out edges? When using adjacency_list directly, I used to have to
specify boost::bidirectionalS:

typedef boost::adjacency_list<boost::vecS, boost::vecS,
boost::bidirectionalS> Graph;

Is something like that required when using directed_graph?

Thanks,

David


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net