Nodes sizes layout from networkx to cytoscape

121 views Asked by At

So I'm building a graph with networkx and I want the size of the nodes to be a certain size according to a certain node attribute. I am trying to add this style setting in the graphml file so that Cytoscape can recognize it. That way you just have to open the file with Cytoscape and you will have that style there without doing anything. Is this possible? I read this question here Transfer layout from networkx to cytoscape but I couldn't get it to work. When I set the node attributes as "h" and "w" Cytoscape didn't recognize them as style setting just as normal attributes.

For example:
import networkx as nx

G = nx.Graph()  
G.add_edge(0,1)  
G.add_edge(2,1)    
importancedic =  {0: {'importance' : 1.6}, 1:{'importance': 4.2}, 2:{'importance':5.4}}    
nx.set_node_attributes(G, importancedic)  

I have this importance dictionary, I want the node to have different sizes according to the values ​​of this dictionary (the smaller the value, the bigger the node).
How can I add this style setting as it appears in graphml and then Cytoscape when imported there?

0

There are 0 answers