Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经编写了以下代码。当我运行此文件时,会生成graph.dot文件而不是graph.jpg。我不明白为什么会这样。有没有人有任何想法? 我的代码如下: require 'rgl/adjacency' require 'rgl/dot' dg=RGL::DirectedAdjacencyGraph[1,2,2,3,2,4,4,5,6,4,1,6] dg.write_to_graphic_file('jpg')
require 'rgl/adjacency'
require 'rgl/dot'
dg=RGL::DirectedAdjacencyGraph[1,2,2,3,2,4,4,5,6,4,1,6]
dg.write_to_graphic_file('jpg')
RGL 使用点文件作为中间格式来生成图像格式,它本身并不生成它们。这就是您看到graph.dot文件的原因。
如果你有一个可用的点二进制文件(GraphViz包的一部分),rgl 将调用它来生成一个graph.jpg文件。
你可以在项目主页下载GraphViz包,或者使用 homebrew(如果你在 Mac 上)用brew install graphviz.
brew install graphviz