Commit aa26ba20 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix issue with GraphView composition

parent 48e68784
...@@ -722,7 +722,7 @@ filter parameters. For example, to create a directed view of the graph ...@@ -722,7 +722,7 @@ filter parameters. For example, to create a directed view of the graph
Graph views also provide a much more direct and convenient approach to Graph views also provide a much more direct and convenient approach to
vertex/edge filtering: To construct a filtered minimum spanning tree vertex/edge filtering: To construct a filtered minimum spanning tree
like in the example above, one must only pass the filter property as the like in the example above, one must only pass the filter property as the
"efilter" parameter: "efilt" parameter:
.. doctest:: .. doctest::
...@@ -764,7 +764,7 @@ Like above, the result should be the isolated minimum spanning tree: ...@@ -764,7 +764,7 @@ Like above, the result should be the isolated minimum spanning tree:
its parent :class:`~graph_tool.Graph` class. Therefore, if the its parent :class:`~graph_tool.Graph` class. Therefore, if the
original :class:`~graph_tool.Graph` object is modified, this original :class:`~graph_tool.Graph` object is modified, this
modification will be reflected immediately in the modification will be reflected immediately in the
:class:`~graph_tool.GraphView` object, and vice-versa. :class:`~graph_tool.GraphView` object, and vice versa.
For even more convenience, one can supply a function as filter For even more convenience, one can supply a function as filter
parameter, which takes a vertex or an edge as single parameter, and parameter, which takes a vertex or an edge as single parameter, and
......
...@@ -2222,7 +2222,7 @@ class Graph(object): ...@@ -2222,7 +2222,7 @@ class Graph(object):
g = GraphView(g, skip_properties=True, skip_efilt=True, g = GraphView(g, skip_properties=True, skip_efilt=True,
skip_vfilt=True, directed=True) skip_vfilt=True, directed=True)
sf = GraphView(sf, skip_properties=True, skip_efilt=True, sf = GraphView(sf, skip_properties=True, skip_efilt=True,
skip_vfilt=True, directed=True) skip_vfilt=True, directed=True)
if src.key_type() == "v": if src.key_type() == "v":
if g.num_vertices() > sf.num_vertices(): if g.num_vertices() > sf.num_vertices():
raise ValueError("graphs with incompatible sizes (%d, %d)" % raise ValueError("graphs with incompatible sizes (%d, %d)" %
...@@ -2443,10 +2443,14 @@ class Graph(object): ...@@ -2443,10 +2443,14 @@ class Graph(object):
if eprop is None: if eprop is None:
eprop = self.new_edge_property("bool") eprop = self.new_edge_property("bool")
eprop.a = not inverted_edges eprop.a = not inverted_edges
else:
eprop = self.own_property(eprop)
if vprop is None: if vprop is None:
vprop = self.new_vertex_property("bool") vprop = self.new_vertex_property("bool")
vprop.a = not inverted_vertices vprop.a = not inverted_vertices
else:
vprop = self.own_property(vprop)
self.__graph.set_vertex_filter_property(_prop("v", self, vprop), self.__graph.set_vertex_filter_property(_prop("v", self, vprop),
inverted_vertices) inverted_vertices)
...@@ -2860,13 +2864,13 @@ class GraphView(Graph): ...@@ -2860,13 +2864,13 @@ class GraphView(Graph):
if not skip_efilt: if not skip_efilt:
ef = list(g.get_edge_filter()) ef = list(g.get_edge_filter())
if ef[0] is not None: if ef[0] is not None:
ef[0] = ef[0].copy() ef[0] = self.own_property(ef[0].copy())
else: else:
ef = [None, False] ef = [None, False]
if not skip_vfilt: if not skip_vfilt:
vf = list(g.get_vertex_filter()) vf = list(g.get_vertex_filter())
if vf[0] is not None: if vf[0] is not None:
vf[0] = vf[0].copy() vf[0] = self.own_property(vf[0].copy())
else: else:
vf = [None, False] vf = [None, False]
......
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