Hier ist mein Code:Graph-Tools Valueerror mit graph_union für gefilterte Graphen
import graph_tool.all as gt
print gt.__version__
g1 = gt.Graph()
g1.add_vertex(5)
g1.add_edge_list([(0,1),(1,2),(2,3),(3,4)])
g2 = gt.Graph()
#g2.add_vertex(3)
#g2.add_edge_list([(0,1),(1,2)])
g1.vp['prop'] = g1.new_vp('int', 1)
g1.ep['eprop'] = g1.new_ep('bool', False)
g1.ep['eprop'][list(g1.edges())[0]]=True
g1.set_edge_filter(g1.ep['eprop'], inverted=True)
#g2.vp['prop'] = g2.new_vp('int', 2)
ug = gt.graph_union(g1, g2, intersection = None, include = True, internal_props=True)
print ug
ug.list_properties()
for e in ug.edges():
print e, ug.ep['eprop'][e]
ich folgende Ausgabe:
2.20 (commit f6ef9990, Fri Jan 27 16:40:08 2017 +0000)
Traceback (most recent call last):
File "Untitled.py", line 17, in
ug = gt.graph_union(g1, g2, intersection = None, include = True, internal_props=True)
File "/usr/local/lib/python2.7/site-packages/graph_tool/generation/init.py", line 1192, in graph_union vmask.a = not vmask.a
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Ich denke, das ähnlich ein Fehler sein kann this bug, zumal in gt.generation__init__.py
Zeile 1185 hat den Bugfix: emask.a = numpy.logical_not(emask.a)
, während Linie 1192 die alte vmask.a = not vmask.a
hat. Kann jemand bestätigen, ob das ein Fehler ist oder ich etwas falsch mache?