I am currently working with a clustering algorithm in python. My data is a sparse matrix with 40,000 node and 400,000 edges. For example:
(0, 10) 1
(0, 14) 1
My clustering result is a python list will be similar to the following but much larger:
[ 9 9 9 9 9 9 9 9 9 9 2 2 2 2 2 2 3 3 3 3 3 3 3 2 6 6 0 2 7 4 2 2 2 2 4 4 4 4 4 10 6 6 6 2 7 7 5 5 1 0 0 10 10 10 0 0 0 1 1 1 1 1 1 1 1 1 1 1 6 6 6 6 2 8 8 6 1]
I originally use networkx to draw the graph but it only works on smaller cases Here is my code:
`
def plotCluster(W, predict):
color = list(col.cnames.keys())
# G = nx.from_numpy_matrix(W)
G = nx.from_scipy_sparse_matrix(W)
print(type(G))
color_map = []
for key in predict:
for i in predict[key]:
color_map.append(color[i+10])
nx.draw(G, node_color=color_map, with_labels=True)
plt.show()`
The result will look like this:
I want to use gephi now, but I can only write my original data as a gexf file and open in gephi. I do not know how to using my own clustering result and draw a similar graph as the python.