Commit 35c18b6a authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix label_largest_component() behavior with filtered graphs

This fixes a bug where filtered vertices would be incorrectly marked, if
the largest component index happend to be zero.
parent 3a8a60e4
......@@ -520,7 +520,11 @@ def label_largest_component(g, directed=None):
label = g.new_vertex_property("bool")
c, h = label_components(g, directed=directed)
label.a = c.a == h.argmax()
vfilt, inv = g.get_vertex_filter()
if vfilt is None:
label.a = c.a == h.argmax()
else:
label.a = (c.a == h.argmax()) & (vfilt.a ^ inv)
return label
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment