Thanks


On 15 Jun 2020, at 16:34, Tiago de Paula Peixoto <tiago@skewed.de> wrote:

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>
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.skewed.de%2Fmailman%2Flistinfo%2Fgraph-tool&amp;data=02%7C01%7C%7Cc36c02f57cef443455e108d81141bff0%7C569df091b01340e386eebd9cb9e25814%7C0%7C0%7C637278321372937467&amp;sdata=nbcfAaDW1LJ%2FYbeDodJDPQPejjeaYQQcOyUwzSm681g%3D&amp;reserved=0