Cannot access vertices of a GraphView

Dear experts,

when I build a GraphView, I cannot access the vertices of an edge. Here
is a minimal example:

import graph_tool as gt
import graph_tool.topology as gtt

G = gt.Graph(directed=False)


for s,t in [(0,1), (2,3), (0,2)]:
     G.add_edge(G.vertex(s), G.vertex(t))

match, is_maximal = gtt.max_cardinality_matching(G)

GV = gt.GraphView(G, efilt=match)

for edge in GV.edges():
     source = GV.vertex_index(edge.source())

I get the following error message:

Traceback (most recent call last):
   File "", line 16, in <module>
     source = GV.vertex_index(edge.source())
   File "/usr/lib/python2.7/site-packages/graph_tool/", line
181, in _type_alias
     raise ValueError("invalid property value type: " + type_name)
ValueError: invalid property value type: unsigned long

Any idea what's wrong here, and more importantly: how to fix it?

Best regards,


do you mean this?

attachment.html (2.29 KB)

In order to access property map items, you have to use the [] operator,
not the call operator, i.e.

    for edge in GV.edges():
        source = GV.vertex_index[edge.source()]

(The call operator expects an array, which is copied to the property
internal values.)


Silly me! I thought that I had used round brackets with ordinary Graphs
(as opposed to GraphViews before), but that was wrong. Thanks for the
swift help!




What's the benefit in using a property map over just calling the attribute
of the edge?


attachment.html (1.55 KB)

None. I did not imply there was any benefit, I just explained what his
mistake was.


Sorry I mean in general. ~ any performance gain? ..... as in is it not a
memory redundancy otherwise?

attachment.html (1.19 KB)

I don't understand your question. What are the cases you are
comparing, and what kind of performance are you talking about?

why can you get the same information using a property map and the edge
attributes? Why is the information duplicated?

attachment.html (1.24 KB)

What information? What edge attribute?

to get edge attributes. ex. which two vertices it connects, why is this
mirrored in property map *and* edge objects? as in the information is
stored twice .... its like having an array of the same information in two
different places.

attachment.html (1.28 KB)

You're not making much effort to explain clearly what you mean. I have
no idea of what property map you are talking about.

Ehh nevermind ~~ sorry for the vague question.

attachment.html (1.33 KB)