|
Boost Users : |
From: Doug Gregor (dgregor_at_[hidden])
Date: 2007-01-30 09:15:19
On Jan 29, 2007, at 8:33 PM, George Sakkis wrote:
> thanks for the prompt reply. Do you happen to have Windows binaries in
> SVN too ?
No, not yet. I'm trying to get all of the pieces together to put out
another release, with binaries.
> By the way, I was trying to get my head around "property maps" and the
> whole time I was thinking how redundant would all this boilerplate be
> in pure Python. Perhaps I'm still missing the point, but why not allow
> subclassing Vertices and Edges and store all (internal) properties as
> attributes in the same object instead of dealing with property maps ?
> I understand that this might be the way to go in a statically typed
> B&D language but is there an advantage of using property maps in a
> language like Python ? If not, I might end up writing a more pythonic
> wrapper around the BGL binding; do you have any insights on how this
> may work out?
I've also tried to address this problem in the development version.
One can create or access new properties by naming the attribute in a
vertex object. For example:
from boost.graph import Graph
g = Graph()
v = g.add_vertex()
v.color = 'Blue' # creates a new vertex property map called
"color". v's color is the string 'Blue'
These are still property maps under the hood, and one can get at the
actual property map as, e.g., vertex_properties['color'] to be passed
to various BGL algorithms.
Cheers,
Doug
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