iit-cs579 / main

CS579: Online Social Network Analysis at the Illinois Institute of Technology
147 stars 204 forks source link

what exactly the function used for def get_betweenness_centrality(graph)? #9

Closed woshihuxingtan closed 10 years ago

woshihuxingtan commented 10 years ago

I looked the NetworkX documentation, there is a function used for computing betweenness centrality for nodes in a bipartite network.


betweenness_centrality(G, nodes)

Parameters :
G : graph A bipartite graph

nodes : list or container Container with all nodes in one bipartite node set.

Returns :
betweenness : dictionary Dictionary keyed by node with bipartite betweenness centrality as the value.


I have tried to used it, but it shows a Name Error as follow:

qq20140906-2 2x

Do I need to import extra library to let it work? Or I just choose an inappropriate function?

mramire8 commented 10 years ago

When you use a module function you need to call it using the module. For example:

module.function(parameters)

In you case you are missing the module and the interpreter will look into your current script for the centrality function. If the function is in networkx module the:

networkx.betweenness_centrality(graph)
woshihuxingtan commented 10 years ago

thanks alot! @mramire8 nx.betweenness_centrality(graph) works