Am 28.06.21 um 20:48 schrieb bnikp...@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 <ti...@skewed.de>
_______________________________________________
graph-tool mailing list -- graph-tool@skewed.de
To unsubscribe send an email to graph-tool-le...@skewed.de

Reply via email to