I am working on my thesis which involves using ant based techniques for graph clustering. I am testing the algorithm currently and I was wondering if there is a way that I can visualize the clusters of a given graph.

In this case, I have the graph as a file and another file corresponding to the clustering where each node is given its cluster. Is there a software using which I can visualize this graph where nodes belonging to the same cluster have like the same color or something?

The graph is represented as an edge list, or in the ".net" format or Graph Modelling Language ".gml" format. I know there are a lot of programs out there for networks such as gephi, graphviz, networkx, pajek etc but I don't know how to do this. Any help/ideas would be greatly appreciated!


  • 1
    $\begingroup$ To avoid some ppl from getting huffy, I suggest rewording the question a tiny drop to make it more like "I have calculated clusters in a graph, I am looking for graph layout algorithms that take into account my cluster-analysis; programs suggestions that implement such layout are welcome". The graph representation really doesn't matter to you; you can easily translate that to some other format. $\endgroup$ – Realz Slaw Dec 4 '13 at 13:47
  • 2
    $\begingroup$ See gvmap, a component of graphviz, see graphiz gallery example. This does the cluster-analysis for you though, I don't think sfdp can take your cluster analysis and lay it out. However, you can surely color your nodes and do all sorts of things with graphviz, see graphiz galleries for countless examples. (continued) $\endgroup$ – Realz Slaw Dec 4 '13 at 14:15
  • 1
    $\begingroup$ (continued) Graphviz can even do user-defined clusters, but not with sfdp, so the automated layout might not be so great (with fdp). Thus, laying out the graph with your user-defined clusters might be problematic with graphviz/sfdp. However, if you can make your own layout algorithm, then you can set explicit positions to the nodes, and have them drawn up with graphviz. $\endgroup$ – Realz Slaw Dec 4 '13 at 14:16
  • $\begingroup$ I'll remember that from now on! Thanks a lot for your info. I was reading some stuff last night and it seems pajek can do the same if I write my output to a ".clu" file and give both the graph and this file as an input to program. I'll look more in to this and what you said as well! :) $\endgroup$ – muddy Dec 4 '13 at 16:41

You could use graphviz. Its input format allows you to specify the color for each vertex. You could write a simple script to take the specification of the graph and the clustering, and output a .dot file that lists the vertices and edges and specifies an appropriate color for each vertex (based upon your clustering).

  • $\begingroup$ Thanks for that! I'll look in to graphviz and pajek. On a side note, I do know how to program, wouldn't have an algorithm to test otherwise. Lol $\endgroup$ – muddy Dec 4 '13 at 16:45
  • $\begingroup$ I have used dot file before and they are great. Since dot files are text, think html, I would suggest that you create the dot files by hand so you can make adjustments faster, then once you understand what you need write the code to generate the dot files. There are lots of options with dot files so this will keep you from coding up lots of fluff. $\endgroup$ – Guy Coder Dec 4 '13 at 18:24
  • $\begingroup$ Thanks a lot for your info! Will definitely look more in to this and evaluate my results! $\endgroup$ – muddy Dec 5 '13 at 16:23

I have implemented clustered circular graph layout algorithm for Graph drawing purpose. For this i have used boost graph library(specially subgraph concept). Boost subgraph is a best solution for anyone to go for graph lay outing problem, it has provided very efficient results to me. Only problem is to study boost library which has very less documentation or may be its very difficult to understand and given in very abstract way. You can try reading following paper for start with layout algorithm as http://ijettcs.org/Volume3Issue2/IJETTCS-2014-04-20-099.pdf


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.