0

I am trying to plot a graph with Python igraph and I want each communities in the graph to be clearly distinguishable just as the image in the link below(I am sorry that I cannot upload images.)

Illustration: communities have different colors I want to plot a graph like this

However, all I can do with my best is

community = g.community_multilevel()
membership = community.membershiplayout = g.layout('kk')
plot(graph, 'test.png', layout = layout, vertex_color=membership,
palette=ClusterColoringPalette(len(set(membership)) + 3), vertex_size = 5)

and the result is not satisfactory because the vertices of different communities are mixed up..

Is there any graph layouts other than 'kk' that emphasizes the communities of graphs?

Édouard Lopez
  • 40,270
  • 28
  • 126
  • 178

1 Answers1

2

There is a similar question for the R version of igraph: How to make grouped layout in igraph? I guess you just need to adapt it to the Python version.

Edit: actually, there's also an existing question for Python igraph: Draw network and grouped vertices of the same community or partition

Community
  • 1
  • 1
Vincent Labatut
  • 1,788
  • 1
  • 25
  • 38