Hi Jeremiah Willcock ,
 
It seems undirected_dfs() works. I have not check the result according to the graph, but at least there is no forward edge or cross edge output.
Attached is the revised cpp file using undirected_dfs() .
My question is why edge_color_map(get(edge_color, g))  is required when calling the undirected_dfs() .
Thanks
 
Zhiyu Li
 
 
2013-06-25

lizy10b

发件人: Jeremiah Willcock
发送时间: 2013-06-24  23:47:20
收件人: boost-users
抄送: lizy10b
主题: Re: [Boost-users] Confused with Depth-First-Search method, forwardor cross edge found on a undirected graph ?
On Mon, 24 Jun 2013, lizy10b wrote:
> Hi爐here
> I爃ave燼爌roblem爓ith爐he燚FS爉ethod?Boost?.53).?
> I爁ound爓hen爄nvoking爐he燚FS爉ethod爋n燼爑ndirected爂raph,爐he?forward_or_cross_edge"爓as燾alled爉ore爐han爋ne爐i
> mes.?
> But燼s爐he燿ocument爏ays?In燼n爑ndirected爂raph爐his爉ethod爄s爊ever燾alled".
> http://www.boost.org/doc/libs/1_53_0/libs/graph/doc/DFSVisitor.html
> ?
> I爌erformed爐he爐est燽ased爋n爐he爁ile_dependencies.cpp爀xample
> ?examples/file_dependencies.cpp;爃ttp://www.boost.org/doc/libs/1_53_0/libs/graph/doc/file_dependency_example.html)
> 1)
> Change爐he爂raph爐ype爁rom?bidirectionalS"爐o?undirected".
> 2)Implement燼ll爐he?燚FS爒istor?event爉ethods"?Initialize燰ertex,燬tart燰ertex,燚iscover燰ertex,燛xamine燛dge,燭
> ree燛dge,燘ack燛dge,燜orward爋r燙ross燛dge,燜inish燰ertex)
> in爐he cycle_detector爏truct爐o爌rint爐he爒ertex爊ames,爀dge爏ources燼nd爐argets.
> 3)comment爋ut爏ome燾ode燼t爐he燽egining爋f爐he爀xample
> cpp爁iles燼s爐he爐opological_sort爉ethod爎aise爀xception爑pon爐he爑ndirected爂raph.
Does undirected_dfs() do the same thing?  I don't think the directed 
version should call forward_or_cross_edge when given an undirected graph, 
though.  Would it be possible for you to print out the vertex->color 
mapping when forward_or_cross_edge is called?  Also, it would be nice if 
you'd send your complete test program.  Thanks.
-- Jeremiah Willcock