0

Given a dataset X and an weight matrix W a networkx graph G is given by

G = nx.Graph(W.todense()) pos = {i: list(p) for i, p in enumerate(X)} nx.set_node_attributes(G, pos, 'pos') 

The graph G has the following structure: enter image description here

Can we store the graph G with the attributes weight and node position in such way to load G in Gephi and visualize the graph using these attributes?

Thank you in advance.

1 Answer 1

2

You have already defined nodes' attributes, so you just need to save it as a file which is acceptable in Gephi by below code:

nx.write_gexf( G, path, encoding='utf-8', prettyprint=True) 

BTW, later on, you can assign any attribute to nodes or edges in .csv format and read and add them to your current graph in Gephi (this could be another option)

Sign up to request clarification or add additional context in comments.

1 Comment

I'm not sure how you assign the networkx weight attribute to the Gephi weight in upload. But you can do it by copying the column in the Data Laboratory

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.