boomer
boomer

Reputation: 35

python, networkx 2.0 'girvan_newman' is not defined

I get the error

NameError: name 'girvan_newman' is not defined

when try to use this algorithm in networkx 2.0. Could someone help to fix this problem?

Upvotes: 1

Views: 2203

Answers (1)

mmam
mmam

Reputation: 86

davedwards is right , you need to provide the missing import statements:

import networkx as nx
from networkx.algorithms import community
communities_generator = community.girvan_newman(G)

Check https://networkx.github.io/documentation/latest/reference/algorithms/community.html

Upvotes: 2

Related Questions