<i id='mgQcn'><tr id='mgQcn'><dt id='mgQcn'><q id='mgQcn'><span id='mgQcn'><b id='mgQcn'><form id='mgQcn'><ins id='mgQcn'></ins><ul id='mgQcn'></ul><sub id='mgQcn'></sub></form><legend id='mgQcn'></legend><bdo id='mgQcn'><pre id='mgQcn'><center id='mgQcn'></center></pre></bdo></b><th id='mgQcn'></th></span></q></dt></tr></i><div id='mgQcn'><tfoot id='mgQcn'></tfoot><dl id='mgQcn'><fieldset id='mgQcn'></fieldset></dl></div>
    • <bdo id='mgQcn'></bdo><ul id='mgQcn'></ul>

    <small id='mgQcn'></small><noframes id='mgQcn'>

  1. <tfoot id='mgQcn'></tfoot>
    1. <legend id='mgQcn'><style id='mgQcn'><dir id='mgQcn'><q id='mgQcn'></q></dir></style></legend>

      graphviz 分段错误

      时间:2023-08-06

      <small id='PvGaK'></small><noframes id='PvGaK'>

        <bdo id='PvGaK'></bdo><ul id='PvGaK'></ul>

            <tfoot id='PvGaK'></tfoot>

                <tbody id='PvGaK'></tbody>
              <legend id='PvGaK'><style id='PvGaK'><dir id='PvGaK'><q id='PvGaK'></q></dir></style></legend>

              • <i id='PvGaK'><tr id='PvGaK'><dt id='PvGaK'><q id='PvGaK'><span id='PvGaK'><b id='PvGaK'><form id='PvGaK'><ins id='PvGaK'></ins><ul id='PvGaK'></ul><sub id='PvGaK'></sub></form><legend id='PvGaK'></legend><bdo id='PvGaK'><pre id='PvGaK'><center id='PvGaK'></center></pre></bdo></b><th id='PvGaK'></th></span></q></dt></tr></i><div id='PvGaK'><tfoot id='PvGaK'></tfoot><dl id='PvGaK'><fieldset id='PvGaK'></fieldset></dl></div>
                本文介绍了graphviz 分段错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在构建一个包含许多节点的图形,大约 3000 个.我编写了一个简单的 python 程序来使用 graphviz 来解决这个问题,但是它给了我分段错误,我不知道为什么,如果图形太大或如果我错过了什么.

                I'm building a graph with many nodes, around 3000. I wrote a simple python program to do the trick with graphviz, but it gives me segmentation fault and I don't know why, if the graph is too big or if i'm missing something.

                代码是:

                #!/usr/bin/env python
                
                # Import graphviz
                import sys
                sys.path.append('..')
                sys.path.append('/usr/lib/graphviz')
                import gv
                
                # Import pygraph
                from pygraph.classes.graph import graph
                from pygraph.classes.digraph import digraph
                from pygraph.algorithms.searching import breadth_first_search
                from pygraph.readwrite.dot import write
                
                # Graph creation
                gr = graph()
                
                file = open('nodes.dat', 'r')
                line = file.readline()
                while line:
                        gr.add_nodes([line[0:-1]])
                        line = file.readline()
                
                file.close()
                print 'nodes finished, beginning edges'
                
                edges = open('edges_ok.dat', 'r')
                edge = edges.readline()
                while edge:
                        gr.add_edge((edge.split()[0], edge.split()[1]))
                        edge = edges.readline()
                
                edges.close()
                print 'edges finished'
                print 'Drawing'
                
                # Draw as PNG
                dot = write(gr)
                gvv = gv.readstring(dot)
                gv.layout(gvv,'dot')
                gv.render(gvv,'svg','graph.svg')
                

                它在 gv.layout() 调用时崩溃.

                这些文件类似于:节点:

                The files are somthing like: nodes:

                   node1
                   node2
                   node3
                

                edges_ok:

                   node1 node2
                   node2 node3
                

                推荐答案

                我把布局类型从dot改成neato,问题就解决了.

                I changed the layout type from dot to neato and that solved the problem.

                我搜索了一下,似乎点布局在大图上有点错误.

                I searched a bit and it seems that the dot layout is a bit faulty on large graphs.

                这篇关于graphviz 分段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:pi 计算中的分段错误(python) 下一篇:来自信号处理程序的 sys.exit() 上的 Python 核心转储

                相关文章

                最新文章

                  <bdo id='HceSd'></bdo><ul id='HceSd'></ul>
              • <legend id='HceSd'><style id='HceSd'><dir id='HceSd'><q id='HceSd'></q></dir></style></legend>
              • <small id='HceSd'></small><noframes id='HceSd'>

                1. <i id='HceSd'><tr id='HceSd'><dt id='HceSd'><q id='HceSd'><span id='HceSd'><b id='HceSd'><form id='HceSd'><ins id='HceSd'></ins><ul id='HceSd'></ul><sub id='HceSd'></sub></form><legend id='HceSd'></legend><bdo id='HceSd'><pre id='HceSd'><center id='HceSd'></center></pre></bdo></b><th id='HceSd'></th></span></q></dt></tr></i><div id='HceSd'><tfoot id='HceSd'></tfoot><dl id='HceSd'><fieldset id='HceSd'></fieldset></dl></div>

                    <tfoot id='HceSd'></tfoot>