networkx GEXF ( 1.1draft) .
. , , ( , , : http://djotjog.com/c/wordtree/ - - ), DiGraph (G), , RGB color size <node> gexf.
...
G.add_nodes_from(nodes)
for n in G.node:
n_size = G.node[n]['size']
G.add_node(n,viz={'color':{'r':"170",'b':"170",'g':"170",'a':"0.7"},'size':n_size})
G.add_weighted_edges_from(edges)
...
import codecs
f = codecs.open(gexf_filename, "wb", "utf-8")
nx.write_gexf(G,f)
f.close()
. , "viz", node "viz" dict . "" RGBA, , , . networkx, GEXF. , . stackoverflow networkx , xml.
XML- GEXF, :
<?xml version="1.0" encoding="utf-8"?><gexf xmlns:ns0="http://www.gexf.net/1.1draft/viz" version="1.1" xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance">
<graph defaultedgetype="directed" mode="static">
<attributes class="node" mode="static">
<attribute id="0" title="size" type="integer" />
</attributes>
<nodes>
<node id="0" label="shop">
<ns0:color b="100" g="100" r="100" />
<ns0:size value="17" />
<attvalues>
<attvalue for="0" value="17" />
</attvalues>
</node>
ns0:. attvalues .
. , node 'size' gexf , .
<?xml version='1.0' encoding='utf-8'?>
<gexf version="1.1" xmlns="http://www.gexf.net/1.1draft" xmlns:viz="http://www.gexf.net/1.1draft/viz" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance">
<attributes class="node" mode="static">
<attribute id="0" title="category" type="string" />
<attribute id="1" title="color" type="string" />
<attribute id="2" title="size" type="integer" />
</attributes>
<node id="CarterCenter" label="CarterCenter">
<attvalues>
<attvalue for="0" value="open data" />
<attvalue for="1" value="blue" />
<attvalue for="2" value="0" />
</attvalues>
</node>
:
http://djotjog.com/s/gexf-web2/data/ocp_network.gexf
http://djotjog.com/s/gexf-web2/data/ocp_network_test.gexf
, :
http://djotjog.com/s/gexf-web2?file=data/ocp_network.gexf ( )
http://djotjog.com/s/gexf-web2?file=data/ocp_network_test.gexf ( , COLOR, -.