首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Graphiz:有向图中的平行方程

Graphiz:有向图中的平行方程
EN

Stack Overflow用户
提问于 2013-10-21 10:33:11
回答 1查看 477关注 0票数 0

我试图建立一个可靠的方案,一个程序,作为有向图的点。因此,我使用了以下代码:

代码语言:javascript
复制
digraph LINK { 
    rankdir=LR; 
    ranksep=0.65;
    nodesep=0.40;
    splines=false; 
    overlap=false;
    concentrate=false; 
    node[shape=box]; 
    subgraph clusterAPP {
            label="Application"; 
            style=dashed; 
            nodeA[label="d = func(...);"]; 

    }; 
    subgraph clusterFB{
            color=red;
            label="Wrapper"; 
            style=dashed; 
            rank=same; 
            wrapper[label="wrapper"]; 
            real[label="pointer to\nreal func"]; 
            wrapper -> real [constraint=false,label="dlopen\ndlsym"]; 
    }
    subgraph clusterBACKEND {
            label="Backend"
            style=dashed; 
            func[label="float func(...)"]; 
    };
    nodeA -> wrapper; 
    real -> func[weight=10];  
    func->real[color=blue]; 
}

这会导致

现在的问题是:

  • realfunc之间的egdes重叠。我怎样才能把它们区分开来,使它们易于辨认。
  • 为什么从wrapperreal的边缘方向是错误的?
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-25 14:34:30

您的第一个问题的答案已经在其他地方给出了,这里是Stackoverflow,归根结底是您可以使用端口位置或者使用臭名昭著的沼泽地所提到的技巧,在相同的方向上添加一个额外的边缘,消除它的约束,反转边缘的方向,隐藏指向后面的边缘。

或者把它写在代码中:

代码语言:javascript
复制
real -> func [weight=10]                    // Remains unaltered  
real -> func [constraint=false, dir=back]   // Remove the constraint and reverse the edge
func -> real [style=invis]                  // Hide the edge pointing pack

至于为什么另一个边缘指向错误的方向,这与constraint有关,应该在2.27版本中修复。您可能正在使用旧版本。(我知道我是的,因为很多*NIX包管理器在默认情况下仍然有2.26.X )。

要解决这个问题,您需要手动将Graphviz更新到较新的版本,或者(如果您已经有了更新的版本或不能/不想更新)将dir=back添加到该节点属性中。

把所有的东西组合在一起,结果是:

使用以下DOT代码:

代码语言:javascript
复制
digraph LINK { 
    rankdir=LR; 
    ranksep=0.65;
    nodesep=0.40;
    splines=false; 
    overlap=false;
    concentrate=false; 
    node[shape=box]; 
    subgraph clusterAPP {
            label="Application"; 
            style=dashed; 
            nodeA[label="d = func(...);"]; 

    }; 
    subgraph clusterFB{
            color=red;
            label="Wrapper"; 
            style=dashed; 
            rank=same; 
            wrapper[label="wrapper"]; 
            real[label="pointer to\nreal func"]; 
    }
    subgraph clusterBACKEND {
            label="Backend"
            style=dashed; 
            func[label="float func(...)"]; 
    };

    nodeA -> wrapper; 
    wrapper -> real [constraint=false, dir=back, label="dlopen\ndlsym"];  // Added reverse direction
    real -> func [weight=10]                    // Remains unaltered  
    real -> func [constraint=false, dir=back]   // Remove the constraint and reverse the edge
    func -> real [style=invis]                  // Hide the edge pointing pack

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19492136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档