Boost logo

Boost Users :

Subject: Re: [Boost-users] transform from std::vector<std::vector<int> > type to boost::adjacency_list< >
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2011-09-30 17:32:02


On Fri, 30 Sep 2011, Pablo Fleurquin wrote:

> Ok, but can you give me a hint, how to write a wrap for this?The
> function I use is boost::strong_connected_component

Look at the documentation page for that algorithm; there is a list of
concepts it requires its graph type to model, with links to individual
documentation pages for those. Those pages will list which functions you
need to implement and how they are supposed to behave. You will also need
a graph_traits specialization; the documentation pages will also say what
that should look like.

-- Jeremiah Willcock

>
> 2011/9/30 Jeremiah Willcock <jewillco_at_[hidden]>
> On Fri, 30 Sep 2011, Pablo Fleurquin wrote:
>
> Yes,
>
>
> The thing is I have a whole code that uses vector<vector<int> > and I only need one function from boost library, but this function wont
> work with vector<vector<int> >.
>
> Changing the script to boost sintax will be time consuming because I´m a newbie. So what are my options?
>
>
> I agree with Dave's suggestion: write wrappers to make a vector<vector<int> > into a Boost graph, modeling whichever concepts your particular algorithm
> needs.  Which algorithm do you want to use?  You can look at its requirements and see what functions you need to implement in order to use it.
>
> -- Jeremiah Willcock
>
>
>
>
>
> 2011/9/30 Dave Abrahams <dave_at_[hidden]>
>
> on Fri Sep 30 2011, Pablo Fleurquin <pablofleurquin-AT-gmail.com> wrote:
>
> > I have an adjacency list, representing a directed graph, written in
> > standard c++ format using vector: vector<vector<int> > I want to
> > tranform it to boost adjacency_list< > format and then back to vector
> > <vector<int> >.
> >
> > Which is the simplest way to do it?
>
> Are you *sure* that's what you want to do?
>
> The usual thing to do in cases like this is to write the necessary
> functions and traits so your type conforms to the graph concept needed
> for your algorithms.  (In fact I think vector<vector<int> > may already
> conform, but I could be mistaken).
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>
>


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