Ensure supplied position map for planar_layout is owned by view
I found that if I tried using the pos
argument to planar_layout
I would get an error:
>>> import graph_tool.all as gt
>>> g = gt.lattice([10, 10])
>>> pos = g.new_vp("vector<double>")
>>> posr = gt.planar_layout(g, pos=pos)
...
ValueError: Received property map for graph <Graph object, undirected, with 100 vertices and 294 edges, at 0x7f0f28470d50> (base: <Graph object, undirected, with 100 vertices and 294 edges, at 0x7f0f28470d50>), expected: <Graph object, undirected, with 100 vertices and 180 edges, at 0x7f0f43447950> (base: <Graph object, undirected, with 100 vertices and 180 edges, at 0x7f0f43447950>)
I believe the issue is that the planar_layout
code operates on an undirected view, with properties removed, and the supplied pos
is for the base graph. The supplied patch appears to fix the issue.