[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-users
Subject:    Re: [Boost-users] Adding additional property in Boost graph object.
From:       Jeremiah Willcock <jewillco () osl ! iu ! edu>
Date:       2009-11-30 20:48:48
Message-ID: alpine.LRH.2.00.0911301546270.16958 () flowerpot ! osl ! iu ! edu
[Download RAW message or body]

On Mon, 30 Nov 2009, Amanullah Yasin wrote:

> Hi, 
> Dear all
> 
> I want to add one additional edge property in Boost graph object of type "bool". \
> Please guide me how i can do it. I tried but not successful.  
> ////////////////////// Here is the main definition of Boost graph object "slGraph"  \
> ///////////////////////////////////////////////////////////////////////// namespace \
> boost { struct computable_object_t
> {
> typedef vertex_property_tag kind;
> };
> }
> 
> typedef boost::property<boost::vertex_index_t, unsigned int,
> boost::property<boost::computable_object_t,
> plComputableObject*> > slVertexProperty;
> 
> typedef boost::property<boost::edge_weight_t, slScoreValueType> slEdgeProperty;
> 
> typedef boost::adjacency_list<boost::vecS, boost::listS, boost::bidirectionalS,
> \                              slVertexProperty, slEdgeProperty> slGraph;
> 
> typedef slGraph::vertex_descriptor slNode;
> typedef slGraph::edge_descriptor slEdge;
> typedef slGraph::vertex_iterator slNodeIterator;
> typedef slGraph::edge_iterator slEdgeIterator;
> typedef slGraph::out_edge_iterator slOutEdgeIterator;
> typedef slGraph::in_edge_iterator slInEdgeIterator;
> typedef slGraph::adjacency_iterator slOutNodeIterator;
> typedef slGraph::inv_adjacency_iterator slInNodeIterator;

You don't need to put your property tag in the boost namespace.  Is there 
anything you tried to do to add the new property and failed?  You can just 
add a new element to the chain of boost::property elements for your edge 
properties (slEdgeProperty), given your property tag (see the definition 
of computable_object_t for how to create a tag, but use edge_property_tag 
for yours).  You can also use bundled properties 
(http://www.boost.org/doc/libs/1_41_0/libs/graph/doc/bundles.html) which 
will greately simplify adding properties.

-- Jeremiah Willcock



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic