做图论的社区检测,需要画图显示,用igraph可以进行可视化。
igraph有几个布局,分别如下:
layout_with_dh : The Davidson-Harel layout algorithm
Place vertices of a graph on the plane, according to the simulated annealing algorithm by Davidson and Harel.
layout_with_drl:The DrL graph layout generator
DrL is a force-directed graph layout toolbox focused on real-world large-scale graphs, developed by Shawn Martin and colleagues at andia National Laboratories
layout_with_fr:The Fruchterman-Reingold layout algorithm
Place vertices on the plane using the force-directed layout algorithm by Fruchterman and Reingold.
layout_with_gem: The GEM layout algorithm
Place vertices on the plane using the GEM force-directed layout algorithm.
layout_with_graphopt:The graphopt layout algorithm
A force-directed layout algorithm, that scales relatively well to large graphs
layout_with_kk: The Kamada-Kawai layout algorithm
Place the vertices on the plane, or in the 3d space, based on a phyisical model of springs.
layout_with_lgl: Large Graph Layout
A layout generator for larger graphs.
layout_with_mds: Graph layout by multidimensional scaling
Multidimensional scaling of some distance matrix defined on the vertices of a graph. 根据距离缩放来显示
layout_with_sugiyama: The Sugiyama graph layout generator
Sugiyama layout algorithm for layered directed acyclic graphs. The algorithm minimized edge crossings.
总结
一共有上述9种布局。
第一种(dh):可以显示出社区与社区间的关系,缺点是社区多了有点分不清。
第二种(drl):不推荐使用
第三种(fr):我比较喜欢的一个布局,可以看清有多少社区。推荐
第四种(gem):不推荐使用
第五种(graphopt):我比较喜欢的一个布局,大的社区放在中间。推荐
第六种(kk):也还不错,可以作为补充选择。
第七种(lgl):不推荐使用,太凌乱
第八种(mds):是个不错的布局,值得推荐,是根据距离缩放来的,可以看得清社区间的联系。
第九种(sugiyama):树状显示,主要为了减少边缘交叉。但是。。。。我不喜欢使用,不推荐。