Boost logo

Boost Users :

Subject: Re: [Boost-users] newbie weighted edges question
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-07-10 11:12:52


On Fri, 10 Jul 2009, Fahad Saeed wrote:

> Hello everyone,
>
> I am new at using Boost libraries and was hoping that someone could give
> me some pointers how to start.The problem that I want to solve is as
> follows:
>
> I want to build a directed graph model with edges that are weighted.But
> instead of having one weight each edge is suppose to have 2 weights, each
> representing a different parameter in my graph model.The weights are to be
> used separately for different functions.
>
> Also, this is trivial but a pointer would certainly help. I would like to
> take each vertice in the graph and ¨know¨ its immediate neighbours.

To do this, create an adjacency_list graph with bundled properties
(http://www.boost.org/doc/libs/1_39_0/libs/graph/doc/bundles.html). You
first create a struct with your weights and attach one struct to each
edge. You can then use the pointer-to-member syntax on the Web page I
pointed to in order to get a property map that represents each individual
weight. You can then pass those separate weight maps to the algorithms
that you want to use. Old-style properties will also work for what you
want but they are deprecated and harder to use.

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