Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] creating a single vertex for the loop in a graph
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-01-12 14:01:08


On Thu, 12 Jan 2012, srinivas boppu wrote:

> Hello All,
>
> I am looking for the following in boost graph.
>
> I have a graph in which I am able to find out the loops.
> Now, I wanted to  replace the  whole loop with  a  single vertex in the same Graph.
>
> Is that possible ? if it is, can you suggest me how do it.

Is this a directed graph? Are you trying to replace each strongly
connected component with a single vertex? In that case, look at
boost/graph/create_condensation_graph.hpp (undocumented AFAIK) and see if
it does what you want. If you just need a topological sort of the
components, use the normal strong_components() function.

> Alternate way could be, I copy the loop and make another graph and  add this  whole graph
> as  a "vertex" in initial  graph.
>
> Can I add a  "graph" as  a vertex to existing graph?   

No; you could have a graph with a vertex property that is another graph,
but that will not allow the graphs stored in properties to link to each
other.

-- 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