Commit 66086427 authored by Tiago Peixoto's avatar Tiago Peixoto

Graph.copy_property(): remove 'compatible graphs' semantics for edge properties

With this, edge properties with convertible types are always copied,
regardless if the edge set is the same between target and source
graphs. In case the edge set is not the same, the properties are copied
only for the edges in the intersection.
parent 24f38401
Pipeline #691 passed with stage
in 64 minutes and 32 seconds
......@@ -214,7 +214,7 @@ struct copy_external_edge_property_dispatch
std::swap(u, v);
auto& es = tgt_edges[std::make_tuple(u, v)];
if (es.empty())
throw ValueException("source and target graphs are not compatible");
continue;
put(dst_map, es.front(), get(src_map, e));
es.pop_front();
}
......
......@@ -2727,6 +2727,24 @@ class Graph(object):
from (defaults to the graph than owns `src`). If ``full == False``, then
in the case of filtered graphs only the unmasked values are copied (with
the remaining ones taking the type-dependent default value).
.. note::
In case the source property map belongs to different graphs, this
function behaves as follows.
For vertex properties, the source and target graphs must have the
same number of vertices, and the properties are copied according to
the index values.
For edge properties, the edge index is not important, and the
properties are copied by matching edges between the different graphs
according to the source and target vertex indexes. In case the graph
has parallel edges with the same source and target vertices, they are
matched according to their iteration order. The edge sets do not have
to be the same between source and target graphs, as the copying
occurs only for edges that lie at their intersection.
"""
if tgt is None:
tgt = self.new_property(src.key_type(),
......
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