Boost logo

Boost Users :

From: Stephan Diederich (stephan.diederich_at_[hidden])
Date: 2007-04-25 18:29:47


Hi Alejandro,

On 4/25/07, Alejandro Marcos Aragón <aaragon2_at_[hidden]> wrote:
> I was wondering if someone could give me a tip on how to construct the
> following graph. The problem is that the queue type definition does not
> know what "edge" is until the type definition for the graph is created.
> Is there a way to get around this?

Yep, for this case there is the adjacency_list_traits class, which is
only templated on EdgeList, VertexList and Directed. You may want to
check
http://www.boost.org/libs/graph/doc/adjacency_list_traits.html
for more information.

> // Type definition for a priority queue of (double,edge) pairs
> typedef std::priority_queue<std::pair<double,int> > edge_queue;

With the above this would read:
typedef adjacency_list_traits< setS, vecS, undirectedS
>::edge_descriptor edge_descriptor;
typedef std::priority_queue< std::pair< double, edge_descriptor > > edge_queue;

HTH,
Stephan


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