graph_union for GraphView fails
#!python
import graph_tool.all as gt
import numpy.random
import random
print gt.__version__
g1 = gt.triangulation(numpy.random.random((300,2)))[0]
g2 = gt.triangulation(numpy.random.random((300,2)))[0]
sel = random.sample(xrange(g1.num_vertices()), int(g1.num_vertices()/2))
selmap = g1.new_vertex_property("bool")
selmap.a = False
for idx in sel: selmap[g1.vertex(idx,use_index=False)] = True # IMPORTANT: use_index=False
g1v = gt.GraphView(g1,vfilt=selmap)
intersection=g1.new_vertex_property("int")
gt.graph_union(g1v,g2,include=True,intersection=intersection)
2.2.32dev (commit 1277a9d4, Mon Jun 9 11:52:31 2014 +0200)
Traceback (most recent call last):
File "./bug_graph_union.py", line 18, in <module>
gt.graph_union(g1v,g2,include=True,intersection=intersection)
File "[...]/graph_tool/generation/__init__.py", line 1024, in graph_union
emask.a = not emask.a
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()