
22 Sep
2005
22 Sep
'05
6:49 a.m.
Vladimir Prus ha scritto:
Giulio Veronesi wrote:
assistance in the following problem: "get all the edges of a cycle".
Of which cycle?
If you want to get at least one cycle in a graph that has one, then you need to create a visitor that implements "back_edge" method and use predecessor map to traverse the cycle in reverse order.
Yes! Only one cycle. Please, could you give me a pratical example (just the pseudo code)? I've very little experience with BGL. Do you intend something like this? template <class Edge, class Graph> void back_edge(Edge e, Graph& g) { clinks.push_back(TLink(source(e, g), target(e, g))); } where: typedef std::pair<int,int> TLink; vector<TLink> clinks; Thanks, Giulio