ashutosh
(ashutosh)
1
Sir,
I am unable to import centrality function from the graph tool package
*import graph_tool as gt*
*gt.centrality.eigenvector(myGraph)*
gives the following error:
*AttributeError: module 'graph_tool' has no attribute 'centrality'*
I tried after restarting my Spyder IDE but the issue remains
I am using graph tool version
'2.27 (commit ce258562, Thu Jun 28 14:29:44 2018 +0100)'
OS: Linux (Ubuntu 64bit)
Hi,
I don't think you're supposed to do "gt.centrality.eigenvector(MyGraph)". Did you try
"gt.eigenvector(MyGraph)"?
ashutosh
(ashutosh)
3
Yes, I tried this too but it doesn't work.
*gt.eigenvector(MyGraph)* doesn't work. It's not listed in the list of
modules inside graph_tool package.
Also documentation specifically mentions
*graph_tool.centrality.eigenvector(g, weight=None, vprop=None,
epsilon=1e-06, max_iter=None)*
that is the command has to be called inside the centrality module of graph
tool package.
tiago
(Tiago Peixoto)
4
In Python, you must first import a module before it can be used. Thus before
using graph_tool.centrality.eigenvector, you must do:
import graph_tool.centrality
As is explained in the graph-tool documentation, the library includes the
graph_tool.all submodule that includes every function. Thus you can also do
import graph_tool.all as gt
and then use directly gt.eigenvector().
Best,
Tiago