Am 15.06.20 um 16:45 schrieb James Ruffle:
Tiago,
I’m sorry that you feel that my code to use the graph_union with intersection, following which to remove parallel edges, then call Graph.copy_property on the union graph, did not follow your instructions which, as far as I can read, specifically asked I use all of those and in that order.
I didn't "feel" it, you had not called copy_property in your example, you had just alluded that it "didn't work".
# To take the union of all edges between two graphs, you can use the graph_union(g1, g2) function, while passing the 'intersection’ parameter with the Graph.vertex_index property map of g2 (to avoid the nodes being duplicated). This will create parallel edges for those that appear in both graphs, which you can remove with remove_parallel_edges(). You can then copy any edge property map from either g1 or g2 by calling Graph.copy_property() on the union graph.
A complete and minimal example with just vertex labels is the following:
It had a syntax error, and some missing parts, but I managed to get it working.
#run copy property on the union graph, where src is the source property, namely the original label file ug.copy_property(src=g.vp.label) ####This is the error I want to fix in this example, and transfer the label property from the original lesmis graph object to the union graph
The documentation of "copy_property" says: "The optional parameter ``g`` specifies the source graph to copy properties from (defaults to self)." Since this not owned by the same graph you need to do: ug.copy_property(src=g.vp.label, g=g) (I will actually change this, so that the default becomes the graph that owns the property, which is less error prone). -- Tiago de Paula Peixoto <tiago@skewed.de>