In extension to the previous example:

ug = gt.graph_union(g,u,intersection=u.vertex_index,internal_props=True)

gt.remove_parallel_edges(ug)

print(ug)

print(g.vp.label[0])

#Myriel

print(ug.vp.label[0])

#’ ‘

#Presumably graph_union wipes the original properties to blank?

#reclaim the lost labels...

label=g.copy_property(src=g.vp.label)

label[0]

#’Myriel’

ug.vp["copied_label"]=label #or similarly, ug.copy_property(src=g.vp.label,tgt=ug.vp.label)

#ValueError: Received property map for graph <Graph object, undirected, with 77 vertices
and 255 edges, 2 internal vertex properties, 1 internal edge property, 2 internal graph properties, at 0x152bc7410> (base: <Graph object, undirected, with 77 vertices and 255 edges, 2 internal vertex properties, 1 internal edge property, 2 internal graph properties,
at 0x152bc7410>), expected: <Graph object, undirected, with 77 vertices and 447 edges, 2 internal vertex properties, 3 internal edge properties, 3 internal graph properties, at 0x153ebb890> (base: <Graph object, undirected, with 77 vertices and 447 edges,
2 internal vertex properties, 3 internal edge properties, 3 internal graph properties, at 0x153ebb890>)

#naturally, collecting the eprob will cause the same error:

ug.copy_property(src=u.ep.eprob,tgt=ug.ep.eprob)

#ValueError:
….

Could you kindly provide a working example to the advised solution?

James

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

Am 15.06.20 um 14:20 schrieb James Ruffle:

It seemed reasonable that one might want to review the results of a MixedMeasuredBlockState with respect to the original graph. For instance, perhaps I have certain vertex or edge properties within my original graph object I want to review for association to this model's collected eprobs. Another example, perhaps I want to run both the Measured and MixedMeasured and compare/contrast the eprobs from the marginals stored as separate edge properties on the graph. Is there a way to marry up these results of the MixedMeasuredBlockState eprob back to the original graph?

There are many ways to do this, I was just asking you to be more

specific about what you wanted to accomplish.

Unless intuitive syntax within GraphTool I am not aware of, I suppose it would be a case of pulling out the edge list from the original and the model, then taking the union of that.

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.

--

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&data=02%7C01%7C%7C68e51ba359f043542be308d811281221%7C569df091b01340e386eebd9cb9e25814%7C0%7C0%7C637278211082967249&sdata=F5AJfZaUI5jO5jlJVVH%2F%2BaHxKEmlGT61ct8n8ybbhrA%3D&reserved=0