Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing clustered graphs in Python

I already have a way of clustering my graph, so the process of clustering isn't the issue here. What I want to do is, once we have all the nodes clustered - to draw the clustered graph in Python, something like this:

enter image description here

I looked into networkx, igraph and graph-tool, but they seem to do the clustering, but not the drawing. Any ideas and propositions of what library should I use for drawing the already clustered graph, which will minimize the number of crossing links?

like image 587
Belphegor Avatar asked May 22 '13 14:05

Belphegor


People also ask

How do you plot a cluster center in Python?

We will also plot the cluster centers as determined by the k-means estimator: In [4]: plt. scatter(X[:, 0], X[:, 1], c=y_kmeans, s=50, cmap='viridis') centers = kmeans.


1 Answers

Take a look at GraphViz http://www.graphviz.org/Gallery/directed/cluster.html There's a Python binding for that, but I have to say I always create the text files directly as they're easy enough to write. Don't be fooled by the plain-looking examples, every aspect of your graph is highly customizable and you can make some pretty nifty graph visualizations with it. Not sure about nested clusters though, never tried that out.

like image 155
Nicolas78 Avatar answered Oct 07 '22 15:10

Nicolas78