Monday 15 July 2013

networkx - Using nx.write_gexf in Python for graphs that have dict data on nodes and edges -


These features are self dictionaries (or lists) with nested dictionaries, because of the data type, how can I write this article to write this article. Gxf format (or .graphml, etc.).

What is the way to write to write? Or is there any other alternative solution?

Here is an example:

  1 import network x nx 2 3G = nx graph (4) G.add_node (0, attr1 = {'name1' : 'Alice', 'Name 2': 'Bob'}, Entry 2 = 5) 5g ADD_Net (0, enter1 = {'name1': 'kelvin', 'name2': 'hobs'}, attr2 = 6) 6g 7-8 nx.written_gfx (g, "test .gfx")   

which returns an error: / P>

  traceback (most recent call final): file "so_write_gefx.py", line 8, & lt; Module & gt; Nx.write_gexf (G, "test.gexf") ... for line 378, add_attributes for val, start, end v: valueError:    

  g.ad_age (0,1, like = {'milk', 'oz'])   

not controlled by GExF author goes.

If you want to be in strings, numbers, etc. then you will not face this problem.

No comments:

Post a Comment