Beginner's trouble with simple graph_tool code snippets
Hi All, After compilation of 40 Hours on my laptop, I have just begun working with graph-tool. I have installed graph-tool-2.9 and my interest lies in finding minimum spanning tree of a graph ..so just tried following code import numpy as np from graph_tool.all import * g, pos = triangulation(np.random((500, 2)) * 4, type="delaunay") tree = min_spanning_tree(g) graph_draw(g, pos=pos, edge_color=tree, output="min_tree.pdf") It throws error " g, pos = triangulation(np.random((500, 2)) * 4, type="delaunay") TypeError: 'module' object is not callable " When I do, g, pos = gt.triangulation(np.random((400, 2)) * 10, type="delaunay") It shows the error NameError: name 'gt' is not defined Is gt python alias for graph_tool? Thanks in advance. -- Warm Regards Yogesh Karpate
Hi, This is more of an numpy issue. Try: numpy.random.random([500,2]) numpy.random is a module which contains a functions called random and only the latter can be called (obviously). Best Soraltan Am 08.10.2015 um 13:49 schrieb Yogesh Karpate:
Hi All, After compilation of 40 Hours on my laptop, I have just begun working with graph-tool. I have installed graph-tool-2.9 and my interest lies in finding minimum spanning tree of a graph ..so just tried following code
import numpy as np from graph_tool.all import * g, pos = triangulation(np.random((500, 2)) * 4, type="delaunay") tree = min_spanning_tree(g) graph_draw(g, pos=pos, edge_color=tree, output="min_tree.pdf")
It throws error "
g, pos = triangulation(np.random((500, 2)) * 4, type="delaunay") TypeError: 'module' object is not callable "
When I do, g, pos = gt.triangulation(np.random((400, 2)) * 10, type="delaunay") It shows the error
NameError: name 'gt' is not defined
Is gt python alias for graph_tool?
Thanks in advance.
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
On 08.10.2015 13:49, Yogesh Karpate wrote:
After compilation of 40 Hours on my laptop, I have just begun working with graph-tool.
If it takes 40 hours to compile, it means that your system is running out of memory and swapping. If you make sure the compilation has sufficient memory, it should take far less than that.
I have installed graph-tool-2.9 and my interest lies in finding minimum spanning tree of a graph ..so just tried following code
import numpy as np from graph_tool.all import * g, pos = triangulation(np.random((500, 2)) * 4, type="delaunay") tree = min_spanning_tree(g) graph_draw(g, pos=pos, edge_color=tree, output="min_tree.pdf")
It throws error "
g, pos = triangulation(np.random((500, 2)) * 4, type="delaunay") TypeError: 'module' object is not callable "
When I do, g, pos = gt.triangulation(np.random((400, 2)) * 10, type="delaunay") It shows the error
NameError: name 'gt' is not defined
Is gt python alias for graph_tool?
This is mentioned in the very beginning of the documentation. https://graph-tool.skewed.de/static/doc/graph_tool.html#how-to-use-the-docum... In short: The docstring examples assume that graph_tool.all has been imported as gt: >>> import graph_tool.all as gt Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (3)
-
Nils Hachmeister -
Tiago de Paula Peixoto -
Yogesh Karpate