我使用Anaconda作为我的主要python发行版(虽然也安装了系统的默认python),因此必须从源代码编译图形工具以使其与Anaconda一起使用.
我正在使用Ubuntu 14.04所以也必须从源代码编译boost以便能够使用graph-tool的全部功能,因为boost-coroutine库目前只编译为静态库(https://bugs.launchpad.net/ ubuntu/+ source/boost1.54/+ bug/1529289).
我已经这样做了,他们都安装了没有任何错误消息,然而,当然后使用from graph_tool.all import *我得到错误消息导入python中的图形工具ImportError: libboost_iostreams.so.1.61.0: cannot open shared object file: No such file or directory.
我怎么能解决这个问题/这是由什么引起的?
我在 Python 3.5.1 上使用图形工具。我有一个单词图,在押韵的单词之间有边缘。当我使用graph-tool的draw函数时,如果顶点设置太大,会导致所有顶点重叠,但是如果它们太小,我必须将字体变小,然后难以辨认。有没有办法设置最小边长或强制顶点不重叠?
代码示例:
import graph_tool.all as gt
G = gt.load_graph("G.gt")
gt.graph_draw(G, vertex_text=G.vertex_properties.word, vertex_font_size=10, output_size=(1000, 1000), output="G.png", vertexsize=10)
Run Code Online (Sandbox Code Playgroud)
我目前正在从Git版本编译图形工具v1.13.我已设法从中生成configure文件,autogen.sh但现在遇到了麻烦.
运行./configure我收到消息:
checking whether g++ supports C++14 features by default... no
checking whether g++ supports C++14 features with -std=gnu++14... no
checking whether g++ supports C++14 features with -std=gnu++0x... no
configure: error: *** A compiler with support for C++14 language features is required.
Run Code Online (Sandbox Code Playgroud)
我已经检查gcc -v并g++ -v收到回复gcc version 4.9.3 (Ubuntu 4.9.3-8ubuntu2~14.04).据我所知,这应该支持C++ 14所以哪里出错了?我正在运行Ubuntu 14.04.
我有许多一维 numpy ndarrays,其中包含给定节点和网络中我想计算平均值的所有其他节点之间的路径长度。问题很复杂,因为如果两个节点之间不存在路径,则算法为该给定连接返回值 2147483647。如果我不处理这个值,它显然会严重夸大我的平均值,因为我的网络中典型的路径长度在 1 到 3 之间。
处理这个问题的一种选择是循环遍历所有数组的所有元素并替换2147483647为NaN,然后使用numpy.nanmean来找到平均值,尽管这可能不是最有效的方法。有没有办法用 numpy 计算平均值而忽略 的所有值2147483647?
我应该补充一点,我可以有多达几百万个数组,其中有几百万个值要平均,因此在如何找到平均值方面的任何性能提升都会产生真正的影响。
我正在做一些分析以计算其值为log_10(x)负数。我现在尝试绘制这些值,但是,由于答案的范围非常大,因此我想使用对数标度。如果我只是简单地使用,则会plt.yscale('log')收到一条消息,告诉我UserWarning: Data has no positive values, and therefore cannot be log-scaled.我也无法提供xto 的值,plt.plot因为to 的结果log_10(x)太大且为负数,因此to 的答案x**(log_10(x))很简单0。
绘制此数据最直接的方法是什么?
graph-tool ×4
python ×3
arrays ×1
boost ×1
c++ ×1
c++14 ×1
configure ×1
g++ ×1
gcc ×1
graph ×1
matplotlib ×1
numpy ×1
performance ×1
python-2.7 ×1