
Boost Users : 
Subject: Re: [Boostusers] BGL: Problem with dijkstra_shortest_paths
From: Alex HagenZanker (ahh34_at_[hidden])
Date: 20110630 09:51:45
> 1. How to I define an edge id and set it when I build my graph?
You are already doing that with: graph[e].id = id;
You have to make sure that your template parameter E is the
edge_descriptor of G. So maybe use the following instead:
template <class G>
static void
graph_add_edge(G &graph, int id, int source, int target, float8 cost)
{
typedef typename graph_traits<G>::edge_descriptor e;
bool inserted;
tie(e, inserted) = add_edge(source, target, graph);
graph[e].cost = cost;
graph[e].id = id;
}
> 2. Given a vertex id and a predecessor id, How do I get the edge id?
template <class G>
static int
get_edge_id(G &graph, int source, int target)
{
typedef typename graph_traits<G>::edge_descriptor e;
bool found;
tie(e, found) = edge(source, target, graph);
return graph[e].id;
}
Boostusers 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