|
Boost Users : |
Subject: Re: [Boost-users] Confused with Depth-First-Search method, forwardor cross edge found on a undirected graph ?
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2013-06-25 15:27:58
On Tue, 25 Jun 2013, lizy10b wrote:
> Hi Jeremiah Willcock,
> Thanks for your reply.
> Another question is the vertex color property also required in undirected_dfs()? or only edge color property is enough?
> Thanks.
There vertex colors are required to know which vertices have already been
visited; directing each edge is not enough to keep track of that.
-- Jeremiah Willcock
> Â
> Â
> 2013-06-25
>
> _________________________________________________________________________________________________________________________________________________________
> lizy10b
>
> _________________________________________________________________________________________________________________________________________________________
> åä»¶äººï¼ Jeremiah Willcock
> åéæ¶é´ï¼ 2013-06-25 00:44:05
> æ¶ä»¶äººï¼ lizy10b
> æéï¼ boost-users
> 主é¢ï¼ Re: Re: [Boost-users] Confused with Depth-First-Search method,forwardor cross edge found on a undirected graph ?
> On Tue, 25 Jun 2013, lizy10b wrote:
> > Hi Jeremiah Willcock ,
> >Â ?
> > It seems undirected_dfs() works. I have notç¾heck 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,ç))?is required when calling the undirected_dfs() .
> >Â Thanks
> It looks like what is going wrong with using directed DFS is that edgesÂ
> are examined twice (once in each direction), and so you can have forwardÂ
> edges even in a symmetric graph (which is how undirected graphs areÂ
> treated in directed-graph algorithms in BGL).  An example is the triangleÂ
> 0 -- 1 -- 2 -- 0: starting at 0 and processing the edges out of a vertexÂ
> in numerical order, 0 -> 1 is a tree edge, 1 -> 0 is a back edge, 1 -> 2Â
> is a tree edge, 2 -> 0 is a back edge, 2 -> 1 is a back edge, then 0 -> 2Â
> is a forward edge.  An undirected DFS would mark 2 -> 0 as a back edgeÂ
> then ignore 0 -> 2 since it is the same as 2 -> 0.  The edge colors inÂ
> undirected_dfs are used to do this filtering-out of multiple directionsÂ
> for the same edge.
> -- Jeremiah Willcock
>
>
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