property map values are not loaded for .graphml graph
Hi, I have saved a graph in Networkx with .graphml format. I can successfully load the graph in graph-tool and I can see the edge property attached to graph. However, when I try to access the values I get an error that the property does not exist. G = gt.load_graph('gdrive/MyDrive/ColabNotebooks/Thesis/sources/k4p3-2-test.graphml') G.properties {('e', '_graphml_edge_id'): <EdgePropertyMap object with value type 'string', for Graph 0x7f0347bd2950, at 0x7f0347d2a4d0>, ('e', 'etype'): <EdgePropertyMap object with value type 'int32_t', for Graph 0x7f0347bd2950, at 0x7f0347d2af50>, ('v', '_graphml_vertex_id'): <VertexPropertyMap object with value type 'string', for Graph 0x7f0347bd2950, at 0x7f0347d2aa50>} e = G.edges().next() etype[e] NameError: name 'etype' is not defined
Am 28.06.21 um 20:48 schrieb bnikparv@gmail.com:
Hi,
I have saved a graph in Networkx with .graphml format. I can successfully load the graph in graph-tool and I can see the edge property attached to graph. However, when I try to access the values I get an error that the property does not exist.
G = gt.load_graph('gdrive/MyDrive/ColabNotebooks/Thesis/sources/k4p3-2-test.graphml') G.properties
{('e', '_graphml_edge_id'): <EdgePropertyMap object with value type 'string', for Graph 0x7f0347bd2950, at 0x7f0347d2a4d0>, ('e', 'etype'): <EdgePropertyMap object with value type 'int32_t', for Graph 0x7f0347bd2950, at 0x7f0347d2af50>, ('v', '_graphml_vertex_id'): <VertexPropertyMap object with value type 'string', for Graph 0x7f0347bd2950, at 0x7f0347d2aa50>}
e = G.edges().next() etype[e] NameError: name 'etype' is not defined
You seem unfamiliar with the Python syntax. In Python, objects need to be declared before they are used. The correct way to obtain the property map would have been: etype = G.ep["etype"] etype[e] -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
bnikparv@gmail.com -
Tiago de Paula Peixoto