Boost logo

Boost Users :

Subject: Re: [Boost-users] [graph] : newbie question on brandes_betweenness_centrality
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-09-21 08:42:22


> ... // I am reading a network from a file and storing it into lEdges and
> lNumVertices
> typedef adjacency_list<vecS, vecS, undirectedS > Graph;
> Graph g(lEdges.begin(), lEdges.end(), lNumVertices);
>
> typedef boost::exterior_vertex_property<Graph, float> BetweennessProperty;
> typedef BetweennessProperty::map_type BetweennessMap;
>
> BetweennessMap lMap;
> brandes_betweenness_centrality(g, lMap);
> }
>
> If I could get this to work, I then have aspirations that the helper
> function central_point_dominance(g, lMap) might give me the betweenness
> centralization measure that I'm after.
>
> Thanks in advance for your help!
>

I would consider steering clear of the exterior_vertex_property template for
now. I haven't had a chance to fully document it and it may change in future
releases. It is very much an undocumented feature.

The lack of documentation is causing your problem. An exterior property
requires two components: a container, which associates data with vertices
and edges, and the property map, which abstracts the association into
something usable in a generic manner. Your property map is not actually
bound to a container (perpahps the default constructor should be private). I
think, what you really want to write is:

typedef BetProperty::container_type Container;
t4ypedef BetProperty::map_type Map;

Container cont(g, /* default value */ );
Map map(cont);

The container is constructed over the graph, assigning a default value to
each vertex. The map is bound to the container.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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