Boost logo

Boost Users :

From: Camilo La Rota (camilo.larota_at_[hidden])
Date: 2007-10-24 05:46:20


Hello all,

I have just installed the Boost Graph Library - Python Bindings.
Everything seemed to be ok, I can read a graph from the example
"mst.dot" file and from my own ".dot" files, I can write them back to a
file.
However, when I try the example script (at the end of the following
page: http://www.osl.iu.edu/~dgregor/bgl-python/),
--------------------------------------------------------------------
import boost.graph as bgl
# Load a graph from the GraphViz file 'mst.dot'
graph = bgl.Graph.read_graphviz('mst.dot')
# Convert the weight into floating-point values
weight = graph.convert_property_map(graph.edge_properties['weight'],
                                      'float')
... etc
-------------------------------------------------------------------

it stops at the third line with the following error:
----------------------------------------------------------------------------
Traceback (most recent call last):
    File "<pyshell#17>", line 1, in <module>
      weight =
graph.convert_property_map(graph.edge_properties['weight'],'float')
KeyError: 'weight'
------------------------------------------------------------------------
I receive the same error message if I write only:
graph.edge_properties['weight']

The content of the example mst.dot file is:
--------------------------------------------------
graph G {
    A -- C [weight="1.0"]
    B -- D [weight="1.0"]
    B -- E [weight="2.0"]
    C -- B [weight="7.0"]
    C -- D [weight="3.0"]
    D -- E [weight="1.0"]
    E -- A [weight="1.0"]
    E -- B [weight="1.0"]
}
--------------------------------------------------

Does any one have any idea about the source of this error.

Thanks a lot in advance,

Camilo


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