0

I would like to use python-igraph to plot a GraphFrame which I have just run LPA on. I understand that there are two ways to do this, however none of them are working. Can someone please help?

1st Approach: Run LPA on GraphFrame and then plot the results

# Generate an LPA graph
lpa_gf = author_keyword_lpa_gf.labelPropagation(maxIter=5).persist().show(10)
label_propagation = Graph.community_label_propagation(lpa_gf, weights=5)

# plot the graph
plot(lpa_gf, vertex_label=author_keyword_lpa_gf.vertices).save('graph2.2.png')

In this case, the lpa_gf variable gives me a proper result in text format. However when I try to plot the Graphframe, I get an error that the plot method cannot take a lpa_gf as an input.

2nd Approach: Run LPA directly on the iGraph

label_propagation = Graph.community_label_propagation(author_keyword_lpa_gf, weights=5)

# plot the graph and display its legend
plot(label_propagation, vertex_label=author_keyword_lpa_gf.vertices).save('graph2.2.png')

In this case I get the following error:

TypeError: descriptor 'community_label_propagation' for 'igraph.Graph' objects doesn't apply to 'GraphFrame' object

Can someone please help me figure out what I am doing wrong?

Szabolcs
  • 24,728
  • 9
  • 85
  • 174
Michele La Ferla
  • 6,775
  • 11
  • 53
  • 79

0 Answers0